Skip to content

Add custom sparse matrix format #6

Open
@IsolatedMy

Description

@IsolatedMy

Hi. I am interested in adding custom sparse matrix format. Is there a tutorial on adding new formats to help me get started quickly?

BTW, when I ran make in the examples/ folder, I got the following error. I wondered if my inappropriate c++ version led to these errors.

g++ -std=c++20 -O3 -I../include -o mdspan_example mdspan_example.cpp 
mdspan_example.cpp: In function ‘int main(int, char**)’:
mdspan_example.cpp:13:8: error: ‘std::experimental’ has not been declared
   13 |   std::experimental::mdspan b_span(data.data(), b.shape()[0], b.shape()[1]);
      |        ^~~~~~~~~~~~
mdspan_example.cpp:15:31: error: ‘b_span’ was not declared in this scope
   15 |   auto view = grb::views::all(b_span);
      |                               ^~~~~~
mdspan_example.cpp:27:19: error: ‘grb::matrix<float, int>::backend_type grb::matrix<float, int>::backend_’ is private within this context
   27 |   auto values = a.backend_.values_.data();
      |                   ^~~~~~~~
In file included from ../include/grb/util/printing.hpp:6,
                 from ../include/grb/util/util.hpp:5,
                 from ../include/grb/grb.hpp:4,
                 from mdspan_example.cpp:1:
../include/grb/containers/matrix.hpp:171:16: note: declared private here
  171 |   backend_type backend_;
      |                ^~~~~~~~
mdspan_example.cpp:27:28: error: ‘grb::csr_matrix<float, int, std::allocator<float> >::vector_type<float, std::allocator<float> > grb::csr_matrix<float, int, std::allocator<float> >::values_’ is private within this context
   27 |   auto values = a.backend_.values_.data();
      |                            ^~~~~~~
In file included from ../include/grb/containers/matrix.hpp:4:
../include/grb/containers/backend/csr_matrix.hpp:180:34: note: declared private here
  180 |   vector_type<T, allocator_type> values_ = vector_type<T, allocator_type>(allocator_);
      |                                  ^~~~~~~
mdspan_example.cpp:28:19: error: ‘grb::matrix<float, int>::backend_type grb::matrix<float, int>::backend_’ is private within this context
   28 |   auto rowptr = a.backend_.rowptr_.data();
      |                   ^~~~~~~~
../include/grb/containers/matrix.hpp:171:16: note: declared private here
  171 |   backend_type backend_;
      |                ^~~~~~~~
mdspan_example.cpp:28:28: error: ‘grb::csr_matrix<float, int, std::allocator<float> >::vector_type<int, std::allocator<int> > grb::csr_matrix<float, int, std::allocator<float> >::rowptr_’ is private within this context
   28 |   auto rowptr = a.backend_.rowptr_.data();
      |                            ^~~~~~~
../include/grb/containers/backend/csr_matrix.hpp:178:49: note: declared private here
  178 |   vector_type<index_type, index_allocator_type> rowptr_ = vector_type<index_type, index_allocator_type>({0}, allocator_);
      |                                                 ^~~~~~~
mdspan_example.cpp:29:19: error: ‘grb::matrix<float, int>::backend_type grb::matrix<float, int>::backend_’ is private within this context
   29 |   auto colind = a.backend_.colind_.data();
      |                   ^~~~~~~~
../include/grb/containers/matrix.hpp:171:16: note: declared private here
  171 |   backend_type backend_;
      |                ^~~~~~~~
mdspan_example.cpp:29:28: error: ‘grb::csr_matrix<float, int, std::allocator<float> >::vector_type<int, std::allocator<int> > grb::csr_matrix<float, int, std::allocator<float> >::colind_’ is private within this context
   29 |   auto colind = a.backend_.colind_.data();
      |                            ^~~~~~~
../include/grb/containers/backend/csr_matrix.hpp:179:49: note: declared private here
  179 |   vector_type<index_type, index_allocator_type> colind_ = vector_type<index_type, index_allocator_type>(allocator_);
      |                                                 ^~~~~~~
make: *** [Makefile:14: mdspan_example] Error 1

My c++ version are as follows

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 12.3.0-1ubuntu1~23.04' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-12-DAPbBt/gcc-12-12.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-DAPbBt/gcc-12-12.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.3.0 (Ubuntu 12.3.0-1ubuntu1~23.04)

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions