Giter Site home page Giter Site logo

simit-lang / simit Goto Github PK

View Code? Open in Web Editor NEW
454.0 45.0 52.0 7.63 MB

A language for computing on sparse systems

Home Page: http://simit-lang.org

License: Other

CMake 0.25% C 0.09% Emacs Lisp 0.02% Makefile 0.01% C++ 99.55% LLVM 0.01% Python 0.03% Vim Script 0.04% Shell 0.01%
simit language linear-algebra graphs sparse-systems llvm

simit's People

Contributors

dannykaufman avatar desaic avatar evouga avatar fredrikbk avatar gesslerpd avatar gkanwar avatar jrk avatar lugatod avatar ptew avatar raywu22 avatar shoaibkamil avatar stephenchouca avatar vikingscientist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simit's Issues

Feature request: modify exising matrix

Sorry if this functionality already exist, but I could not find it. Say I have two functions, which both should contribute to my system matrix and/or force vectors. Is it possible to chain these, so the second would be added to the results from the first, instead of just overwriting. In the example below I was hoping to get 3 along the diagonal, but I only get 2.

element Vertex
end

extern verts : set{Vertex};

func assemble_one(v : Vertex) -> (K : matrix[verts,verts](float))
    K(v,v) = 1.0;
end

func assemble_two(v : Vertex) -> (K : matrix[verts,verts](float))
    K(v,v) = 2.0;
end

export func main()
    var K = map assemble_one to verts reduce +;
    K     = map assemble_two to verts reduce +;
    print K;
end

Project roadmap, contribution guide, and communication for onboarding new developers

Hello to the Simit team,

I'm interested in contributing to the project, as with probably a number of other lurkers. It would be useful to have a central roadmap containing the explicit project development goals, so that we can pitch and discuss ideas that are in line with the goals.

A contribution guide would also be particularly useful, since it seems at first glance that the codebase has some good standards in place already.

The Github wiki functionality would be a natural place for these things.

I don't know if the mailing list is a good medium for communication, so I also recommend setting up a chat/post system. I am partial to https://gitter.im, which I have seen used successfully on other github-based projects; it is a web-based public chat room system that has a very good free version and supports integration with github projects.

I look forward to contributing, and airing some ideas!

Cheers,

-Chris.

Sparse matrix transpose and subtraction

The lowering pass currently does not support sparse matrix transpose or subtraction, e.g.

export func main()
   A = map f to V;
   B = A';  % fails to compile
   C = A - A;  % fails to compile as well
end

PathIndexBuilder builds un-necessary SegmentedIndices from EV links

This was added in 6eac2fb to make EV matrices work, since we don't have codegen machinery to compute with elpack indices yet. When we get this machinery it should be changed back.

But even before then the PathIndexBuilder only needs to build a segmented index if it is going to be returned to the user. If it is just built internally to bootstrap a vev matrix then we can build an SetEndpointIndex instead.

Until then we do unnecessary work and consume unnecessary memory.

Inefficient Matrix Multiplication on GPU

The matrix multiplication code we emit is not tailored to GPU execution (no parallelism).

This will be fixed with the sparse tensor compilation theory, so we should consider leaving it to then. If someone really needs it we can add a custom solution.

Assembly functions should use `+=`

Assembly functions currently use = to assign to their element matrix. This causes issue with code generation, because our current backends rewrites the assignments to plus-assign directly into the system matrix. If the user assigns to the same location twice, the result is that the values are accumulated, instead of overwritten. To avoid this, we can either:

  1. Keep element matrices on the stack, and only write them to the system matrix at the end of local assembly, or
  2. Force assembly functions to use +=, which makes the behavior match what happens right now.

I think we should do 2 for now, and add support for = later iff it's needed. Keeping element matrices on the stack and copying them may have performance implications. Due to improved locality these could actually go either way..

Compilation error: eigen complains about not getting column-major matrices

Fresh install of Ubuntu 16.04 and using llvm-3.8-dev and libeigen3-dev I get compilation error. Full log given below:

In file included from /usr/include/eigen3/Eigen/Core:297:0,
                 from .../simit/src/runtime.h:17,
                 from .../simit/src/runtime.cpp:1:
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h: In instantiation of ‘void Eigen::internal::solve_sparse_through_dense_panels(const Decomposition&, const Rhs&, Dest&) [with Decomposition = Eigen::SparseLU<Eigen::SparseMatrix<float, 0, int>, Eigen::COLAMDOrdering<int> >; Rhs = Eigen::SparseMatrix<float, 1, int>; Dest = Eigen::SparseMatrix<float, 1, int>]’:
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h:99:50:   required from ‘void Eigen::SparseSolverBase<Derived>::_solve_impl(const Eigen::SparseMatrixBase<OtherDerived>&, Eigen::SparseMatrixBase<OtherDerived>&) const [with Rhs = Eigen::SparseMatrix<float, 1, int>; Dest = Eigen::SparseMatrix<float, 1, int>; Derived = Eigen::SparseLU<Eigen::SparseMatrix<float, 0, int>, Eigen::COLAMDOrdering<int> >]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:164:5:   required from ‘static void Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar>, Eigen::internal::Sparse2Sparse, Scalar>::run(DstXprType&, const SrcXprType&, const Eigen::internal::assign_op<Scalar>&) [with DstXprType = Eigen::SparseMatrix<float, 1, int>; DecType = Eigen::SparseLU<Eigen::SparseMatrix<float, 0, int>, Eigen::COLAMDOrdering<int> >; RhsType = Eigen::SparseMatrix<float, 1, int>; Scalar = float; Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar>, Eigen::internal::Sparse2Sparse, Scalar>::SrcXprType = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<float, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:38:16:   required from ‘Derived& Eigen::SparseMatrixBase<Derived>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<float, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >; Derived = Eigen::SparseMatrix<float, 1, int>]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:1106:27:   required from ‘Eigen::SparseMatrix<_Scalar, _Options, _Index>& Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<float, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >; _Scalar = float; int _Options = 1; _Index = int]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:674:15:   required from ‘Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::SparseMatrix(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<float, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >; _Scalar = float; int _Options = 1; _Index = int]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:1061:40:   required from ‘Eigen::SparseMatrix<_Scalar, _Options, _Index>& Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<float, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >; _Scalar = float; int _Options = 0; _Index = int]’
.../simit/src/runtime.cpp:312:5:   required from ‘int lumatsolve(void**, int, int, int*, int*, int, int, Float*, int, int, int**, int**, int, int, Float**) [with Float = float]’
.../simit/src/runtime.cpp:327:63:   required from here
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES
     #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
                                        ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h:24:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT’
   EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
   ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h: In instantiation of ‘void Eigen::internal::solve_sparse_through_dense_panels(const Decomposition&, const Rhs&, Dest&) [with Decomposition = Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<int> >; Rhs = Eigen::SparseMatrix<double, 1, int>; Dest = Eigen::SparseMatrix<double, 1, int>]’:
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h:99:50:   required from ‘void Eigen::SparseSolverBase<Derived>::_solve_impl(const Eigen::SparseMatrixBase<OtherDerived>&, Eigen::SparseMatrixBase<OtherDerived>&) const [with Rhs = Eigen::SparseMatrix<double, 1, int>; Dest = Eigen::SparseMatrix<double, 1, int>; Derived = Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<int> >]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:164:5:   required from ‘static void Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar>, Eigen::internal::Sparse2Sparse, Scalar>::run(DstXprType&, const SrcXprType&, const Eigen::internal::assign_op<Scalar>&) [with DstXprType = Eigen::SparseMatrix<double, 1, int>; DecType = Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<int> >; RhsType = Eigen::SparseMatrix<double, 1, int>; Scalar = double; Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar>, Eigen::internal::Sparse2Sparse, Scalar>::SrcXprType = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:38:16:   required from ‘Derived& Eigen::SparseMatrixBase<Derived>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >; Derived = Eigen::SparseMatrix<double, 1, int>]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:1106:27:   required from ‘Eigen::SparseMatrix<_Scalar, _Options, _Index>& Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >; _Scalar = double; int _Options = 1; _Index = int]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:674:15:   required from ‘Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::SparseMatrix(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >; _Scalar = double; int _Options = 1; _Index = int]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:1061:40:   required from ‘Eigen::SparseMatrix<_Scalar, _Options, _Index>& Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >; _Scalar = double; int _Options = 0; _Index = int]’
.../simit/src/runtime.cpp:312:5:   required from ‘int lumatsolve(void**, int, int, int*, int*, int, int, Float*, int, int, int**, int**, int, int, Float**) [with Float = double]’
.../simit/src/runtime.cpp:336:63:   required from here
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES
     #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
                                        ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h:24:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT’
   EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
   ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h: In instantiation of ‘void Eigen::internal::solve_sparse_through_dense_panels(const Decomposition&, const Rhs&, Dest&) [with Decomposition = Eigen::SimplicialCholesky<Eigen::SparseMatrix<float, 0, int>, 1, Eigen::AMDOrdering<int> >; Rhs = Eigen::SparseMatrixBase<Eigen::SparseMatrix<float, 1, int> >; Dest = Eigen::SparseMatrixBase<Eigen::SparseMatrix<float, 1, int> >]’:
/usr/include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h:631:50:   required from ‘void Eigen::SimplicialCholesky<_MatrixType, _UpLo, _Ordering>::_solve_impl(const Eigen::SparseMatrixBase<OtherDerived>&, Eigen::SparseMatrixBase<OtherDerived>&) const [with Rhs = Eigen::SparseMatrix<float, 1, int>; Dest = Eigen::SparseMatrix<float, 1, int>; _MatrixType = Eigen::SparseMatrix<float, 0, int>; int _UpLo = 1; _Ordering = Eigen::AMDOrdering<int>]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:164:5:   required from ‘static void Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar>, Eigen::internal::Sparse2Sparse, Scalar>::run(DstXprType&, const SrcXprType&, const Eigen::internal::assign_op<Scalar>&) [with DstXprType = Eigen::SparseMatrix<float, 1, int>; DecType = Eigen::SimplicialCholesky<Eigen::SparseMatrix<float, 0, int>, 1, Eigen::AMDOrdering<int> >; RhsType = Eigen::SparseMatrix<float, 1, int>; Scalar = float; Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar>, Eigen::internal::Sparse2Sparse, Scalar>::SrcXprType = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<float, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:38:16:   required from ‘Derived& Eigen::SparseMatrixBase<Derived>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<float, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >; Derived = Eigen::SparseMatrix<float, 1, int>]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:1106:27:   required from ‘Eigen::SparseMatrix<_Scalar, _Options, _Index>& Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<float, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >; _Scalar = float; int _Options = 1; _Index = int]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:674:15:   required from ‘Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::SparseMatrix(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<float, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >; _Scalar = float; int _Options = 1; _Index = int]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:1061:40:   required from ‘Eigen::SparseMatrix<_Scalar, _Options, _Index>& Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<float, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<float, 1, int> >; _Scalar = float; int _Options = 0; _Index = int]’
.../simit/src/runtime.cpp:425:5:   required from ‘int lltmatsolve(void**, int, int, int*, int*, int, int, Float*, int, int, int**, int**, int, int, Float**) [with Float = float]’
.../simit/src/runtime.cpp:440:64:   required from here
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES
     #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
                                        ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h:24:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT’
   EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
   ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h: In instantiation of ‘void Eigen::internal::solve_sparse_through_dense_panels(const Decomposition&, const Rhs&, Dest&) [with Decomposition = Eigen::SimplicialCholesky<Eigen::SparseMatrix<double, 0, int>, 1, Eigen::AMDOrdering<int> >; Rhs = Eigen::SparseMatrixBase<Eigen::SparseMatrix<double, 1, int> >; Dest = Eigen::SparseMatrixBase<Eigen::SparseMatrix<double, 1, int> >]’:
/usr/include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h:631:50:   required from ‘void Eigen::SimplicialCholesky<_MatrixType, _UpLo, _Ordering>::_solve_impl(const Eigen::SparseMatrixBase<OtherDerived>&, Eigen::SparseMatrixBase<OtherDerived>&) const [with Rhs = Eigen::SparseMatrix<double, 1, int>; Dest = Eigen::SparseMatrix<double, 1, int>; _MatrixType = Eigen::SparseMatrix<double, 0, int>; int _UpLo = 1; _Ordering = Eigen::AMDOrdering<int>]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:164:5:   required from ‘static void Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar>, Eigen::internal::Sparse2Sparse, Scalar>::run(DstXprType&, const SrcXprType&, const Eigen::internal::assign_op<Scalar>&) [with DstXprType = Eigen::SparseMatrix<double, 1, int>; DecType = Eigen::SimplicialCholesky<Eigen::SparseMatrix<double, 0, int>, 1, Eigen::AMDOrdering<int> >; RhsType = Eigen::SparseMatrix<double, 1, int>; Scalar = double; Eigen::internal::Assignment<DstXprType, Eigen::Solve<DecType, RhsType>, Eigen::internal::assign_op<Scalar>, Eigen::internal::Sparse2Sparse, Scalar>::SrcXprType = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<double, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:38:16:   required from ‘Derived& Eigen::SparseMatrixBase<Derived>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<double, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >; Derived = Eigen::SparseMatrix<double, 1, int>]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:1106:27:   required from ‘Eigen::SparseMatrix<_Scalar, _Options, _Index>& Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<double, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >; _Scalar = double; int _Options = 1; _Index = int]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:674:15:   required from ‘Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::SparseMatrix(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<double, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >; _Scalar = double; int _Options = 1; _Index = int]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:1061:40:   required from ‘Eigen::SparseMatrix<_Scalar, _Options, _Index>& Eigen::SparseMatrix<_Scalar, _Flags, _StorageIndex>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Solve<Eigen::SimplicialCholesky<Eigen::SparseMatrix<double, 0, int>, 1, Eigen::AMDOrdering<int> >, Eigen::SparseMatrix<double, 1, int> >; _Scalar = double; int _Options = 0; _Index = int]’
.../simit/src/runtime.cpp:425:5:   required from ‘int lltmatsolve(void**, int, int, int*, int*, int, int, Float*, int, int, int**, int**, int, int, Float**) [with Float = double]’
.../simit/src/runtime.cpp:449:64:   required from here
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES
     #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
                                        ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h:24:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT’
   EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
   ^
make[2]: *** [src/CMakeFiles/simit.dir/runtime.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/simit.dir/all] Error 2
make: *** [all] Error 2

Problems with EIGEN when making the BUILD folder

Hi,
I'm having problems running the simit-test.

It gets hanged at " apply.vertices":

[==========] Running 469 tests from 56 test cases.
[----------] Global test environment set-up.
[----------] 3 tests from apply
[ RUN ] apply.vertices

Automatic type casting (int->float)

Right now Simit is very particular about the type of literals, and does not automatically cast floats to ints. This results in a type error for this code:

a : float = 1;

Obviously we want to assign 1.0 to a, but the type checker reports an error because I am trying to assign an integer to a float.

Can't assign to component of blocked system matrix in assembly

The following code:

func asm(e : Edge, v : (Vertex*2)) -> K : matrix[V,V](matrix[2, 2](int))
  K(v(0),v(0))(0, 0) = 1;  % error because we're assigning to component
end

triggers the assert

Compiler bug at /Users/kjoelsta/Dropbox/projects/simit/simit/src/lower/lower_maps.cpp:109 in visit
Please report it to http://issues.simit-lang.org
 Condition failed: isa<TupleRead>(index) || isa<VarExpr>(index)
 0 is not a tuple read or a var expr
 IR stack:
 ... K(v(0),v(0))(0,0) = 1;
 ... As = map asm to E with V reduce +;
 ... func main

Test case in 7b91251.

Temporary workaround:

  var k : matrix[2,2](int) = 0;
  k(0,0) = 1;
  K(v(0),v(0)) = k;

Bulk assignment

Let's add bulk assignment to tensors using square bracket tensor literal syntax:

var A : matrix[2,2](float) = [expr0, expr1; expr2, expr3];

, where the expri is any expression.

This was needed by @mike323zyf in the following code:

var X_g = [0.0, 0.0; 0.0, 0.0];

X_g(0, 0) = ver(1).u(0) - ver(0).u(0);
X_g(1, 0) = ver(1).u(1) - ver(0).u(1);
X_g(0, 1) = ver(2).u(0) - ver(0).u(0);
X_g(1, 1) = ver(2).u(1) - ver(0).u(1);

denominator = X_g(0, 0) * X_g(1, 1) - X_g(0, 1) * X_g(1, 0);

tri.B = [       X_g(1, 1) / denominator,  -1.0 * X_g(0, 1) / denominator;
         -1.0 * X_g(1, 0) / denominator,  X_g(0, 0)        / denominator];


Add support for llvm > 3.4.2

We are currently bound to support llvm 3.4.2 because of the dependency on NVIDIA's NVCC library, which requires it. However, we should add support for later llvm versions, and over time transition away from NVCC.

simit-check fails on documentation example

The following bit of code is taken directly from the documentation:

element Point
  x : vector[3](float);
  v : vector[3](float);
end

func move(p : Point)
  p.x(0) += 1.0;  % p.x += [1.0, 0.0, 0.0];
end

simit-check returns:
Error: expected an expression but got '=', at 7:11

Changing p.x(0) += 1.0; to p.x(0) + p.x(0) + 1.0; gives a different error:
Error: assignment target is not writable, at 7:3-8

apps test suite

The applications in the apps directory should be tested by simit-test. This means we should add an apps test suite that compiles the apps, and then runs them on small generated examples (e.g. a 3-chain or two tetrahedra). The results should be compared to golden results.

@gkanwar pointed out that we need something like this to guard against the issues @rennis250 ran into in #39.

The apps test suite replaces the current Program test suite, as there's no need to not bundle up all the programs and expose them to users.

Note that this does not test the C++ part of the example code, so we may also want add jenkins hooks to build and run those (and check results).

Stencil assembly fails when stencil inputs are assigned to variable

The following code causes a stencil assembly to fail:

  self = l[0,0;0,1].a + l[0,0; 0,-1].a +
         l[0,0;1,0].a + l[0,0;-1, 0].a;
  vnMat(orig,orig) = self;

The error message is:

Internal error at /Users/kjoelsta/Dropbox/projects/simit/simit/src/stencil_norm.cpp:31 in visit
 Condition failed: rowNormOff.size() != 0
 Set read visit not paired to output write

This is exposed by the (disabled) test issue.44 in 14e2067.

Variables in global scope

We need support for variables in global scope, specifically tensor and opaque variables. This is needed to precompute matrices, vectors and opaque solver objects that don't change between time steps (e.g. ARAP energies).

opaque type

It is useful to be able to return arbitrary data from extern functions that are later passed back to extern functions. For example, if I use an extern function to do Cholesky factorization with the Eigen library followed later by another extern function that uses the factorization, then I need to be able to pass the Eigen solver object between the two extern functions.

To support this we can add an opaque type to Simit that maps to a void* in C extern functions. So an extern function can return a void*, simit stores it as an opaque object and later passes it back to C. It is up to the extern functions to delete opaque objects.

Scalar FieldRef are not printing

FieldRef vector and matrices print nicely to screen, but scalar (float and int) just output empty strings

#include "graph.h"
#include <iostream>

using namespace simit;
using namespace std;

int main(int argc, char **argv) {
    Set verts;
    FieldRef<double,2,2>  A = verts.addField<double,2,2>("A");
    FieldRef<double,3>    x = verts.addField<double,3>(  "x");
    FieldRef<double>      u = verts.addField<double>(    "u");
    FieldRef<int>         i = verts.addField<int>(       "i");

    ElementRef pt;
    pt = verts.add();
    A(pt) = {0,0,0,0};
    x(pt) = {0,0,0};
    u(pt) = 0;
    i(pt) = 0;
    pt = verts.add();
    A(pt) = {1,2,3,4};
    x(pt) = {1,0,0};
    u(pt) = 12.3;
    i(pt) = 1;

    for(auto e : verts) {
        cout << A(e) << endl; // prints matrix
        cout << x(e) << endl; // prints vector
        cout << u(e) << endl; // prints nothing
        cout << i(e) << endl; // prints nothing
        double value = u(e);
        cout << value << endl;// prints correct value
    }

} 

Solve on diagonal matrix: Segmentation fault

C++ code

#include "graph.h"
#include "program.h"

using namespace simit;
using namespace std;

int main(int argc, char **argv) {
    init("cpu", sizeof(double));
    Set verts;

    ElementRef pt;
    for(int j=0; j<30; j++)
        pt = verts.add();

    Program program;
    program.loadFile("min.sim");
    Function func = program.compile("main");
    func.bind("verts", &verts);

    func.runSafe();

} 

with the file min.sim as the following

element Vertex
end

extern verts : set{Vertex};

func assemble(v : Vertex) -> (K : matrix[verts,verts](float),
                              b : vector[verts](float))
    K(v,v) = 1.0;
    b(v)   = 1.0;
end

export func main()
    K,b = map assemble to verts reduce +;
    u = K \ b;
end

Results in segmentation fault. Here is the full backtrace:

#0  0x00007ffff69058b2 in simit::ir::TensorIndex::getKind (this=0x64e988) at .../simit/src/tensor_index.cpp:47
#1  0x00007ffff69336e6 in simit::ir::TensorStorage::getTensorIndex (this=0x7fffffffca00) at .../simit/src/storage.cpp:56
#2  0x00007ffff6abc980 in simit::backend::LLVMBackend::emitArgument (this=0x649b70, argument=..., excludeStaticTypes=true)
    at .../simit/src/backend/llvm/llvm_backend.cpp:704
#3  0x00007ffff6abcf19 in simit::backend::LLVMBackend::emitArguments (this=0x649b70, arguments=std::vector of length 3, capacity 3 = {...}, 
    excludeStaticTypes=true) at .../simit/src/backend/llvm/llvm_backend.cpp:756
#4  0x00007ffff6abe6a5 in simit::backend::LLVMBackend::emitIntrinsicCall (this=0x649b70, callStmt=...)
    at .../simit/src/backend/llvm/llvm_backend.cpp:905
#5  0x00007ffff6ac06fa in simit::backend::LLVMBackend::compile (this=0x649b70, callStmt=...)
    at .../simit/src/backend/llvm/llvm_backend.cpp:1035
#6  0x00007ffff6ad3ce8 in simit::backend::BackendVisitor<llvm::Value*>::visit (this=0x649b78, op=0x658d60)
    at .../simit/src/backend/backend_visitor.h:144
#7  0x00007ffff68ea20a in simit::ir::CallStmt::accept (this=0x658d60, v=0x649b78) at .../simit/src/ir.h:356
#8  0x00007ffff690b681 in simit::ir::Stmt::accept (this=0x656900, v=0x649b78) at .../simit/src/ir.h:107
#9  0x00007ffff6a9a6a7 in simit::backend::BackendVisitorBase::compile (this=0x649b78, op=...)
    at .../simit/src/backend/backend_visitor.cpp:37
#10 0x00007ffff6ad43b3 in simit::backend::BackendVisitor<llvm::Value*>::compile (this=0x649b78, op=...)
    at .../simit/src/backend/backend_visitor.h:111
#11 0x00007ffff6ad3eaa in simit::backend::BackendVisitor<llvm::Value*>::visit (this=0x649b78, op=0x6568f0)
    at .../simit/src/backend/backend_visitor.h:153
#12 0x00007ffff68ea368 in simit::ir::Block::accept (this=0x6568f0, v=0x649b78) at .../simit/src/ir.h:444
#13 0x00007ffff690b681 in simit::ir::Stmt::accept (this=0x656a00, v=0x649b78) at .../simit/src/ir.h:107
#14 0x00007ffff6a9a6a7 in simit::backend::BackendVisitorBase::compile (this=0x649b78, op=...)
    at .../simit/src/backend/backend_visitor.cpp:37
#15 0x00007ffff6ad43b3 in simit::backend::BackendVisitor<llvm::Value*>::compile (this=0x649b78, op=...)
    at .../simit/src/backend/backend_visitor.h:111
#16 0x00007ffff6ad3eaa in simit::backend::BackendVisitor<llvm::Value*>::visit (this=0x649b78, op=0x6569f0)
    at .../simit/src/backend/backend_visitor.h:153
#17 0x00007ffff68ea368 in simit::ir::Block::accept (this=0x6569f0, v=0x649b78) at .../simit/src/ir.h:444
#18 0x00007ffff690b681 in simit::ir::Stmt::accept (this=0x656600, v=0x649b78) at .../simit/src/ir.h:107
#19 0x00007ffff6a9a6d2 in simit::backend::BackendVisitorBase::compile (this=0x649b78, op=...)
    at .../simit/src/backend/backend_visitor.cpp:39
#20 0x00007ffff6ad43b3 in simit::backend::BackendVisitor<llvm::Value*>::compile (this=0x649b78, op=...)
    at .../simit/src/backend/backend_visitor.h:111
#21 0x00007ffff6ad3eaa in simit::backend::BackendVisitor<llvm::Value*>::visit (this=0x649b78, op=0x6565e0)
---Type <return> to continue, or q <return> to quit---
    at .../simit/src/backend/backend_visitor.h:153
#22 0x00007ffff68ea368 in simit::ir::Block::accept (this=0x6565e0, v=0x649b78) at .../simit/src/ir.h:444
#23 0x00007ffff690b681 in simit::ir::Stmt::accept (this=0x652780, v=0x649b78) at .../simit/src/ir.h:107
#24 0x00007ffff6a9a519 in simit::backend::BackendVisitorBase::accept (this=0x649b78, stmt=...)
    at .../simit/src/backend/backend_visitor.cpp:18
#25 0x00007ffff6ac90fd in simit::backend::BackendVisitorExprHelper<llvm::Value*>::compile (this=0x649b78, stmt=...)
    at .../simit/src/backend/backend_visitor.h:42
#26 0x00007ffff6ac1995 in simit::backend::LLVMBackend::compile (this=0x649b70, scope=...)
    at .../simit/src/backend/llvm/llvm_backend.cpp:1143
#27 0x00007ffff6ad3d7e in simit::backend::BackendVisitor<llvm::Value*>::visit (this=0x649b78, op=0x652770)
    at .../simit/src/backend/backend_visitor.h:147
#28 0x00007ffff68ea23c in simit::ir::Scope::accept (this=0x652770, v=0x649b78) at .../simit/src/ir.h:362
#29 0x00007ffff690b681 in simit::ir::Stmt::accept (this=0x658440, v=0x649b78) at .../simit/src/ir.h:107
#30 0x00007ffff6a9a6d2 in simit::backend::BackendVisitorBase::compile (this=0x649b78, op=...)
    at .../simit/src/backend/backend_visitor.cpp:39
#31 0x00007ffff6ad43b3 in simit::backend::BackendVisitor<llvm::Value*>::compile (this=0x649b78, op=...)
    at .../simit/src/backend/backend_visitor.h:111
#32 0x00007ffff6ad3eaa in simit::backend::BackendVisitor<llvm::Value*>::visit (this=0x649b78, op=0x658420)
    at .../simit/src/backend/backend_visitor.h:153
#33 0x00007ffff68ea368 in simit::ir::Block::accept (this=0x658420, v=0x649b78) at .../simit/src/ir.h:444
#34 0x00007ffff690b681 in simit::ir::Stmt::accept (this=0x7fffffffda00, v=0x649b78) at .../simit/src/ir.h:107
#35 0x00007ffff6a9a519 in simit::backend::BackendVisitorBase::accept (this=0x649b78, stmt=...)
    at .../simit/src/backend/backend_visitor.cpp:18
#36 0x00007ffff6ac90fd in simit::backend::BackendVisitorExprHelper<llvm::Value*>::compile (this=0x649b78, stmt=...)
    at .../simit/src/backend/backend_visitor.h:42
#37 0x00007ffff6ab65f4 in simit::backend::LLVMBackend::compile (this=0x649b70, func=..., storage=...)
    at .../simit/src/backend/llvm/llvm_backend.cpp:161
#38 0x00007ffff6a912cc in simit::backend::Backend::compile (this=0x63d6d0, func=..., storage=...) at .../simit/src/backend/backend.cpp:48
#39 0x00007ffff69224fe in simit::compile (func=..., backend=0x63d6d0, addTimers=false) at .../simit/src/program.cpp:36
#40 0x00007ffff69225a7 in simit::compile (func=..., backend=0x63d6d0) at .../simit/src/program.cpp:40
#41 0x00007ffff6922ffd in simit::Program::compile (this=0x7fffffffdc30, function="main") at .../simit/src/program.cpp:104
#42 0x000000000040c34e in main (argc=1, argv=0x7fffffffde78) at .../simit-fem/min.cpp:22

Does not compile with current LLVM

I installed the current LLVM (brew install llvm), which is version 3.8.1. Compiling gives me the following errors.

[ 35%] Building CXX object src/CMakeFiles/simit.dir/backend/llvm/llvm_backend.cpp.o
/Users/yotam/Work/ext/simit/src/backend/llvm/llvm_backend.cpp:1589:14: error: no matching member function for call to 'insert'
    symtable.insert(*simitArgIt, llvmArgIt);
    ~~~~~~~~~^~~~~~
/Users/yotam/Work/ext/simit/src/util/scopedmap.h:41:8: note: candidate function not viable: no known conversion from
      'llvm::ilist_iterator<llvm::Argument>' to 'llvm::Value *const' for 2nd argument
  void insert(const Key &symbol, const Value &value) {
       ^
/Users/yotam/Work/ext/simit/src/util/scopedmap.h:46:8: note: candidate function not viable: requires single argument 'symVal', but 2
      arguments were provided
  void insert(const std::pair<Key, Value> &symVal) {
       ^
/Users/yotam/Work/ext/simit/src/backend/llvm/llvm_backend.cpp:1594:14: error: no matching member function for call to 'insert'
    symtable.insert(*simitResIt, llvmArgIt);
    ~~~~~~~~~^~~~~~
/Users/yotam/Work/ext/simit/src/util/scopedmap.h:41:8: note: candidate function not viable: no known conversion from
      'llvm::ilist_iterator<llvm::Argument>' to 'llvm::Value *const' for 2nd argument
  void insert(const Key &symbol, const Value &value) {
       ^
/Users/yotam/Work/ext/simit/src/util/scopedmap.h:46:8: note: candidate function not viable: requires single argument 'symVal', but 2
      arguments were provided
  void insert(const std::pair<Key, Value> &symVal) {
       ^
2 errors generated.

Windows Support

Can I build simit in windows? o is better in a linux distro?
If I can in windows can someone tell me how please?

Error naming a tensor variable free

If a tensor variable is named free then the backend assert fails, presumably because there are internal functions named free. The following test fails:

func main(a : vector[2](int)) -> b : vector[2](int)
  free = a;
  b = free*2;
end

Remove `proc` keyword

The proc keyword has been deprecated in favor of export func so we should remove it from the parser.

Strange type inference error message

The following incorrect code gets very strange error messages:

func asm(e : Edge, p : (Vertex*2)) -> A : tensor[V,E](int)
  A(e, p(0)) = 1;
  A(e, p(1)) = 1;
end
Error: element declared to be of type 'Edge' but inferred to be of type 'Vertex', at 12:14-17
Error: element declared to be of type 'Vertex' but inferred to be of type 'Edge', at 12:25-30

I would expect it to report that the wrong types are used to index into A. Instead it seems to try to infer the type of the arguments.

trace

Note: This lets us reduce the size of the tetrahedral neo-hookean FEM example code.

error: no matching function for call to 'simit::util::ScopedMap<simit::ir::Var, llvm::Value*>::insert(const simit::ir::Var&, llvm::ilist_iterator<llvm::Argument>&)'

/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_backend.cpp: In member function 'llvm::Function* simit::backend::LLVMBackend::emitEmptyFunction(const string&, const std::vector<simit::ir::Var>&, const std::vector<simit::ir::Var>&, bool, bool, bool)':
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_backend.cpp:1578:43: error: no matching function for call to 'simit::util::ScopedMap<simit::ir::Var, llvm::Value*>::insert(const simit::ir::Var&, llvm::ilist_iterator<llvm::Argument>&)'
     symtable.insert(*simitArgIt, llvmArgIt);
                                           ^
In file included from /home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_backend.h:15:0,
                 from /home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_backend.cpp:1:
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/util/scopedmap.h:41:8: note: candidate: void simit::util::ScopedMap<Key, Value>::insert(const Key&, const Value&) [with Key = simit::ir::Var; Value = llvm::Value*]
   void insert(const Key &symbol, const Value &value) {
        ^~~~~~
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/util/scopedmap.h:41:8: note:   no known conversion for argument 2 from 'llvm::ilist_iterator<llvm::Argument>' to 'llvm::Value* const&'
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/util/scopedmap.h:46:8: note: candidate: void simit::util::ScopedMap<Key, Value>::insert(const std::pair<_T1, _T2>&) [with Key = simit::ir::Var; Value = llvm::Value*]
   void insert(const std::pair<Key, Value> &symVal) {
        ^~~~~~
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/util/scopedmap.h:46:8: note:   candidate expects 1 argument, 2 provided
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_backend.cpp:1583:43: error: no matching function for call to 'simit::util::ScopedMap<simit::ir::Var, llvm::Value*>::insert(const simit::ir::Var&, llvm::ilist_iterator<llvm::Argument>&)'
     symtable.insert(*simitResIt, llvmArgIt);
                                           ^
In file included from /home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_backend.h:15:0,
                 from /home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_backend.cpp:1:
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/util/scopedmap.h:41:8: note: candidate: void simit::util::ScopedMap<Key, Value>::insert(const Key&, const Value&) [with Key = simit::ir::Var; Value = llvm::Value*]
   void insert(const Key &symbol, const Value &value) {
        ^~~~~~
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/util/scopedmap.h:41:8: note:   no known conversion for argument 2 from 'llvm::ilist_iterator<llvm::Argument>' to 'llvm::Value* const&'
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/util/scopedmap.h:46:8: note: candidate: void simit::util::ScopedMap<Key, Value>::insert(const std::pair<_T1, _T2>&) [with Key = simit::ir::Var; Value = llvm::Value*]
   void insert(const std::pair<Key, Value> &symVal) {
        ^~~~~~
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/util/scopedmap.h:46:8: note:   candidate expects 1 argument, 2 provided
src/CMakeFiles/simit.dir/build.make:1289: recipe for target 'src/CMakeFiles/simit.dir/backend/llvm/llvm_backend.cpp.o' failed
make[2]: *** [src/CMakeFiles/simit.dir/backend/llvm/llvm_backend.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_function.cpp: In member function 'virtual simit::backend::Function::FuncType simit::backend::LLVMFunction::init()':
/home/brain/rpmbuild/BUILD/simit-6083206fcd97909daf04bf2bc5968363feb31136/src/backend/llvm/llvm_function.cpp:344:45: error: cannot convert 'llvm::ilist_iterator<llvm::Argument>' to 'llvm::Argument*' in initialization
       llvm::Argument* llvmFormal = llvmArgIt++;
                                             ^~

llvm-3.8.0-1.fc25.x86_64

GPU ffi

The foreign function interface (ffi) is not supported on GPUs. This blocks adding GPU direct solvers (lu/chol).

Visualizer

It would be great if someone could develop a visualizer (or integrate an existing one).

Our current visualizer has gone unused and experienced code rot. I also believe it uses glut and we'd like to use glfw for cross platform. We should style our visualizer on the one in libigl, and maybe even make libigl an optional dependency and use their visualizer.

Matrix/vector parameters with set dimensions

Back end currently does not support calling functions with matrix or vector parameters that have set dimensions, e.g.

extern points : set{Point};

func foo(M : matrix[points,points](float))
   % Do something here...
end

export func main()
   const A : matrix[points,points](float) = map f to points;
   foo(A);
end

Assemble element matrices in assembly functions

It is often convenient to assemble element matrices in assemblies. For example, to compute the vertices*vertices element stiffness matrix K_1, it can be convenient to compute the vertices*edges element matrix A_1 and compute K_1=AA^T.

This requires us to support assembling A_1 from a vertex tuple inside the function that assembles K_1.

abs and fabs

Add an intrinsic to compute the absolute value of scalar ints and floats.

It is not compiled on VirtualBox with LinuxMint 18

— Debug Build
— Found Eigen
— Shared library
— Building without gpu-backend
— Could NOT find OpenGL (missing: OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR)
— Could NOT find GLUT (missing: GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
Could not find OpenGL or GLUT so simviz will not be built
— Found LLVM: llvm-config (version "3.8.0")
— Configuring done
— Generating done
...
simit/src/runtime.cpp:327:64: required from here
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES
#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
e.t.c.

cmake splits libaries path on "-"

Seems like custom llvm placed,say in: "/opt/package/platform-linux/llvm/3.4.2/" isn't appreciated by simit CMake.

It seems like some part of CMakeList.txt post process library path and splits it. Maybe here?

execute_process(COMMAND "${LLVM_CONFIG}" --libfiles ${LLVM_COMPONENTS} OUTPUT_VARIABLE LLVM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
separate_arguments(LLVM_LIBS) # Turn the space-separate string into a ;-separated list
target_link_libraries(${PROJECT_NAME} PRIVATE ${LLVM_LIBS})

Not a terrible thing after all, but still might surprise someone.

Matrix literal parser errors

When I run the solver.schur_blocked test (DISABLED on line 235 in solver-test.cpp 6174b0b), I get the following parser errors:

Program contains the following errors:
 Error: expected '(' but got '=', at 21:9
 Error: expected '=' but got ']', at 21:30
 Error: expected '(' but got ';', at 27:24
 Error: expected '(' but got ';', at 32:24
 Error: expected '(' but got ';', at 34:22
 Error: expected '(' but got ';', at 35:22

This seems to come from the sequence of two 2x2 matrix definitions on lines 20--21:

fixed = [2.0, 1.0; 1.0, 2.0];
free  = [1.0, 1.0; 1.0, 1.0];

If I replace these lines with the following it works:

var fixed : matrix[2,2](float) = [2.0, 1.0; 1.0, 2.0];
var free  : matrix[2,2](float) = [1.0, 1.0; 1.0, 1.0];

Note that this code has other problems too that will be uncovered when this bug is fixed.

Grid stencil generated indices not ordered

According to e95fae8 the CSR sinks of indices assembled from stencils are not ordered. If this is true then element wise operations on these matrices will not work, since the merge operations rely on ordering.

Can't compile with SIMIT_CUDA_ENABLE=1

Hi,
I successfully compiled simit with clang and gcc and ran it with the CPU back-end, but with the GPU back-end (activated with export SIMIT_CUDA_ENABLE=1) I ended up with errors during the compilation.

In file included from /home/???/Code/simit/src/backend/backend.cpp:6:
/home/???/Code/simit/src/backend/gpu/gpu_backend.h:62:34: error: no type named 'Call' in namespace
      'simit::ir'
  virtual void compile(const ir::Call&);
                             ~~~~^
/home/???/Code/simit/src/backend/backend.cpp:26:12: error: cannot initialize return object of type
      'simit::backend::BackendImpl *' with an rvalue of type 'backend::GPUBackend *'
    return new backend::GPUBackend();
           ^~~~~~~~~~~~~~~~~~~~~~~~~
>clang --version
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix
>gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

Any ideas that would correct it ?
Thanks.

Feature request: precision-control when printing from simit programs

Printing is using the default of 8-decimal precision when using the print-function from inside a simit program.

This is inadequate if one where to transfer results for debugging purposes between environments (i.e. matlab). Calling std::setprecision(16) from the #include <iomanip> did not help.

Would it be possible to add a function to either the Program-class or Function-class to accommodate this need? Perhaps give the print function itself an optional precision argument?

FEM application is not self contained

apps/fem/fem.cpp is not self contained as it requires the existence of mesh files to run. These files are simply referred to as *.node and *.ele, but their structure is not documented anywhere. The closest thing to a documentation I've found is in mesh.h, but the format described here is outdated and/or wrong.

I would like to either see a good mesh-file documentation or an example mesh-file provided in the apps/fem/ folder.

Feature requests (simple operations & functions)

There are a number of simple functions which I would like to see added support for

  • A = a * B scalar-matrix multiplication
  • A = B * a matrix-scalar multiplication
  • b = a * c scalar-vector multiplication
  • b = c * a vector-scalar multiplication
  • det(A : matrix[2,2](float) ) 2x2 determinant
  • det(A : matrix[4,4](float) ) 4x4 determinant
  • inv(A : matrix[2,2](float) ) 2x2 inverse
  • inv(A : matrix[4,4](float) ) 4x4 inverse
  • eye(n : int) -> matrix[n,n](float) returns identity matrix
  • min(vector[V](float)) -> float returns minimum value
  • max(vector[V](float)) -> float returns maximum value
  • abs(float) -> float returns absolute value
  • abs(int) -> int returns absolute value
  • abs(vector[V](float)) -> vector[V](float) returns absolute value
  • abs(vector[V](int)) -> vector[V](int) returns absolute value
  • cbrt(float) -> float returns cube root
  • size(Set) -> int returns size of set

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.