cyclops-community / ctf

Cyclops Tensor Framework: parallel arithmetic on multidimensional arrays
Other
194 stars 53 forks source link

comparison operator should be const #133

Closed raghavendrak closed 2 years ago

raghavendrak commented 2 years ago

Some versions of the compiler flag this as error: error: static assertion failed: comparison object must be invocable as const #131

jeffhammond commented 2 years ago

I don't understand it yet but when I compile with -std=c++20 and not 17 or 14, I get the following error. Given that C++20 is becoming the default language level in recent compilers, it might be worth figuring out this issue.

make[3]: Entering directory '/home/jhammond/AQUARIUS/ctf/src/interface'
/usr/bin/mpicxx.mpich -w -std=c++20 -fopenmp -Wall  -D_POSIX_C_SOURCE=200112L -D__STDC_LIMIT_MACROS -DFTN_UNDERSCORE=1 -DUSE_LAPACK   -c ring.cxx -o /home/jhammond/AQUARIUS/ctf/obj/ring.o
In file included from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.h:26:34: error: expected ‘)’ before ‘const’
   26 |       Vector<dtype>(Vector<dtype> const & A);
      |                    ~             ^~~~~~
      |                                  )
../../include/../src/interface/vector.h:32:35: error: invalid declarator before ‘const’
   32 |       Vector<dtype>(Tensor<dtype> const & A);
      |                                   ^~~~~
../../include/../src/interface/vector.h:32:34: error: expected ‘)’ before ‘const’
   32 |       Vector<dtype>(Tensor<dtype> const & A);
      |                    ~             ^~~~~~
      |                                  )
In file included from ../../include/../src/interface/vector.h:136,
                 from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.cxx:50:3: error: no declaration matches ‘CTF::Vector<dtype>::Vector(const CTF::Vector<dtype>&)’
   50 |   Vector<dtype>::Vector(Vector<dtype> const & A)
      |   ^~~~~~~~~~~~~
In file included from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.h:102:7: note: candidates are: ‘CTF::Vector<dtype>::Vector(int64_t, char, const CTF::Idx_Partition&, const CTF::Idx_Partition&, int, CTF::World&, const CTF_int::algstrct&, const char*, int)’
  102 |       Vector(int64_t                   len,
      |       ^~~~~~
../../include/../src/interface/vector.h:80:7: note:                 ‘CTF::Vector<dtype>::Vector(int64_t, int, CTF::World&, const char*, int, const CTF_int::algstrct&)’
   80 |       Vector(int64_t                   len,
      |       ^~~~~~
../../include/../src/interface/vector.h:65:7: note:                 ‘CTF::Vector<dtype>::Vector(int64_t, int, CTF::World&, const CTF_int::algstrct&)’
   65 |       Vector(int64_t                   len,
      |       ^~~~~~
../../include/../src/interface/vector.h:52:7: note:                 ‘CTF::Vector<dtype>::Vector(int64_t, CTF::World&, const char*, int, const CTF_int::algstrct&)’
   52 |       Vector(int64_t                   len,
      |       ^~~~~~
../../include/../src/interface/vector.h:40:7: note:                 ‘CTF::Vector<dtype>::Vector(int64_t, CTF::World&, const CTF_int::algstrct&)’
   40 |       Vector(int64_t                   len,
      |       ^~~~~~
In file included from ../../include/../src/interface/vector.h:136,
                 from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.cxx:47:3: note:                 ‘CTF::Vector<dtype>::Vector()’
   47 |   Vector<dtype>::Vector() : Tensor<dtype>() { }
      |   ^~~~~~~~~~~~~
In file included from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.h:14:9: note: ‘class CTF::Vector<dtype>’ defined here
   14 |   class Vector : public Tensor<dtype> {
      |         ^~~~~~
In file included from ../../include/../src/interface/vector.h:136,
                 from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.cxx:56:3: error: no declaration matches ‘CTF::Vector<dtype>::Vector(const CTF::Tensor<dtype>&)’
   56 |   Vector<dtype>::Vector(Tensor<dtype> const & A)
      |   ^~~~~~~~~~~~~
In file included from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.h:102:7: note: candidates are: ‘CTF::Vector<dtype>::Vector(int64_t, char, const CTF::Idx_Partition&, const CTF::Idx_Partition&, int, CTF::World&, const CTF_int::algstrct&, const char*, int)’
  102 |       Vector(int64_t                   len,
      |       ^~~~~~
../../include/../src/interface/vector.h:80:7: note:                 ‘CTF::Vector<dtype>::Vector(int64_t, int, CTF::World&, const char*, int, const CTF_int::algstrct&)’
   80 |       Vector(int64_t                   len,
      |       ^~~~~~
../../include/../src/interface/vector.h:65:7: note:                 ‘CTF::Vector<dtype>::Vector(int64_t, int, CTF::World&, const CTF_int::algstrct&)’
   65 |       Vector(int64_t                   len,
      |       ^~~~~~
../../include/../src/interface/vector.h:52:7: note:                 ‘CTF::Vector<dtype>::Vector(int64_t, CTF::World&, const char*, int, const CTF_int::algstrct&)’
   52 |       Vector(int64_t                   len,
      |       ^~~~~~
../../include/../src/interface/vector.h:40:7: note:                 ‘CTF::Vector<dtype>::Vector(int64_t, CTF::World&, const CTF_int::algstrct&)’
   40 |       Vector(int64_t                   len,
      |       ^~~~~~
In file included from ../../include/../src/interface/vector.h:136,
                 from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.cxx:47:3: note:                 ‘CTF::Vector<dtype>::Vector()’
   47 |   Vector<dtype>::Vector() : Tensor<dtype>() { }
      |   ^~~~~~~~~~~~~
In file included from ../../include/../src/interface/tensor.h:1284,
                 from ../../include/ctf.hpp:17,
                 from ring.cxx:1:
../../include/../src/interface/vector.h:14:9: note: ‘class CTF::Vector<dtype>’ defined here
   14 |   class Vector : public Tensor<dtype> {
      |         ^~~~~~
make[3]: *** [Makefile:12: /home/jhammond/AQUARIUS/ctf/obj/ring.o] Error 1
make[3]: Leaving directory '/home/jhammond/AQUARIUS/ctf/src/interface'
make[2]: *** [Makefile:10: interface] Error 2
make[2]: Leaving directory '/home/jhammond/AQUARIUS/ctf/src'
make[1]: *** [Makefile:93: ctf_objs] Error 2
make[1]: Leaving directory '/home/jhammond/AQUARIUS/ctf'
make: *** [Makefile:238: /home/jhammond/AQUARIUS/ctf/lib/libctf.a] Error 2
raghavendrak commented 2 years ago

@jeffhammond maybe we should have this opened as a separate issue?

susilehtola commented 2 years ago

@raghavendrak the patch you get from https://patch-diff.githubusercontent.com/raw/cyclops-community/ctf/pull/133.patch

appears to be broken since you've merged the master branch instead of rebasing