{"action":"closed","issue":{"url":"https://api.github.com/repos/fwinter/qdp-jit/issues/5","repository_url":"https://api.github.com/repos/fwinter/qdp-jit","labels_url":"https://api.github.com/repos/fwinter/qdp-jit/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/fwinter/qdp-jit/issues/5/comments","events_url":"https://api.github.com/repos/fwinter/qdp-jit/issues/5/events","html_url":"https://github.com/fwinter/qdp-jit/issues/5","id":193762715,"number":5,"title":"Specialization for WordType<C> for C=QDP::OScalar<QDP::PSpinMatrix<QDP::PScalar<QDP::RComplex<QDP::Word<REAL={REAL32={float}}>>>, 4>> is missing","user":{"login":"martin-ueding","id":976924,"avatar_url":"https://avatars.githubusercontent.com/u/976924?v=3","gravatar_id":"","url":"https://api.github.com/users/martin-ueding","html_url":"https://github.com/martin-ueding","followers_url":"https://api.github.com/users/martin-ueding/followers","following_url":"https://api.github.com/users/martin-ueding/following{/other_user}","gists_url":"https://api.github.com/users/martin-ueding/gists{/gist_id}","starred_url":"https://api.github.com/users/martin-ueding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martin-ueding/subscriptions","organizations_url":"https://api.github.com/users/martin-ueding/orgs","repos_url":"https://api.github.com/users/martin-ueding/repos","events_url":"https://api.github.com/users/martin-ueding/events{/privacy}","received_events_url":"https://api.github.com/users/martin-ueding/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-06T12:41:32Z","updated_at":"2016-12-08T14:55:31Z","closed_at":"2016-12-08T14:55:31Z","body":"I have just cloned the repository and tried to compile the `master` branch on JURECA, an Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz system with Intel C++ version 17.\r\n\r\nConfiguration was done using\r\n\r\n```\r\n$sourcedir/$repo/configure --prefix=$prefix --disable-shared --enable-static CC=$cc CXX=$cxx \\                                   \r\n        --enable-openmp \\                                                          \r\n        --enable-parallel-arch=parscalar \\                                         \r\n        --enable-parallel-io \\                                                     \r\n        --enable-sse --enable-sse2 \\                                               \r\n        --with-libxml2=\"$prefix/bin/xml2-config\" \\                                 \r\n        --with-qmp=\"$prefix\" \\                                                     \r\n        CFLAGS=\"$cflags\" CXXFLAGS=\"$cxxflags\"\r\n```\r\nwhere `$cflags` and `$cxxflags` are `-O2 -Wall -fopenmp` and for C++ also `--std=c++11`, `cc` and `cxx` are the paths to the MPI wrappers of Intel C++ compilers.\r\n\r\nIt seems that there is a template specification of `WordType` for the type `QDP::OScalar<QDP::PSpinMatrix<QDP::PScalar<QDP::RComplex<QDP::Word<REAL={REAL32={float}}>>>, 4>>` is missing.\r\n\r\n```\r\ndepbase=`echo qdp_map.o | sed 's|[^/]*$|.deps/&|;s|\\.o$||'`;\\\r\n/usr/local/software/jureca/Stages/2016b/software/impi/2017.0.098-iccifort-2017.0.098-GCC-5.4.0/bin64/mpiicpc -DHAVE_CONFIG_H -I. -I/homec/hbn28/hbn28e/Sources/qdp-jit/lib -I../include    -I/homec/hbn28/hbn28e/Sources/qdp-jit/include -I../include -I/homec/hbn28/hbn28e/Sources/qdp-jit/other_libs/qio/include -I../other_libs/qio/include -I/homec/hbn28/hbn28e/Sources/qdp-jit/other_libs/qio/other_libs/c-lime/include -I../other_libs/qio/other_libs/c-lime/include -I/homec/hbn28/hbn28e/Sources/qdp-jit/other_libs/xpath_reader/include -I/homec/hbn28/hbn28e/Sources/qdp-jit/other_libs/libintrin/include -I../other_libs/libintrin/include  -I/homec/hbn28/hbn28e/local-jureca/include/libxml2 -I/homec/hbn28/hbn28e/local-jureca/include  -I/usr/local/cuda/include -O2 -Wall -fopenmp --std=c++11 -MT qdp_map.o -MD -MP -MF $depbase.Tpo -c -o qdp_map.o /homec/hbn28/hbn28e/Sources/qdp-jit/lib/qdp_map.cc &&\\\r\nmv -f $depbase.Tpo $depbase.Po\r\nIn file included from /homec/hbn28/hbn28e/Sources/qdp-jit/include/qdp.h(187),\r\n                 from /homec/hbn28/hbn28e/Sources/qdp-jit/lib/qdp_map.cc(8):\r\n/homec/hbn28/hbn28e/Sources/qdp-jit/include/qdp_qdptype.h(51): error: incomplete type is not allowed\r\n    C& assign(const typename WordType<C>::Type_t& rhs)\r\n                             ^\r\n          detected during:\r\n            instantiation of class \"QDP::QDPType<T, C> [with T=QDP::PSpinMatrix<QDP::PScalar<QDP::RComplex<QDP::Word<REAL={REAL32={float}}>>>, 4>, C=QDP::OScalar<QDP::PSpinMatrix<QDP::PScalar<QDP::RComplex<QDP::Word<REAL={REAL32={float}}>>>, 4>>]\" at line 35 of \"/homec/hbn28/hbn28e/Sources/qdp-jit/include/qdp_outer.h\"\r\n            instantiation of class \"QDP::OScalar<T> [with T=QDP::PSpinMatrix<QDP::PScalar<QDP::RComplex<QDP::Word<REAL={REAL32={float}}>>>, 4>]\" at line 243 of \"/homec/hbn28/hbn28e/Sources/qdp-jit/include/qdp_outer.h\"\r\n```\r\n\r\nThe definition of `WordType` has a comment stating that the user must give the appropriate specialization for a container to participate in the JIT compilation process. Looking through the code I was able to find the specialization for `OScalar` in `include/qdp_outer.h`:\r\n\r\n```c++\r\ntemplate<class T>\r\nstruct WordType<OScalar<T> > \r\n{\r\n  typedef typename WordType<T>::Type_t  Type_t;\r\n};\r\n```\r\n\r\nThis seems to be a recursive template thing, there must be specializations all the way down to get to the one where it actually is a pre-defined type. The stack that must be traversed is this here:\r\n\r\n- `QDP::OScalar`\r\n- `QDP::PSpinMatrix`\r\n- `QDP::PScalar`\r\n- `QDP::RComplex`\r\n- `QDP::Word`\r\n- `float`\r\n\r\nThe next level is the `PSpinMatrix` which also has a specialization in `include/qdp_primspinmat.h`:\r\n\r\n```c++\r\ntemplate<class T1, int N>\r\nstruct WordType<PSpinMatrix<T1,N> > \r\n{\r\n  typedef typename WordType<T1>::Type_t  Type_t;\r\n};\r\n```\r\n\r\nThen `PScalar` in `include/qdp_primscalar.h`:\r\n\r\n```c++\r\ntemplate<class T>\r\nstruct WordType<PScalar<T> > \r\n{\r\n  typedef typename WordType<T>::Type_t  Type_t;\r\n};\r\n```\r\n\r\nThere is `RComplex` in `include/qdp_reality.h`. The compiler cannot resolve that from `lib/qdp_map.cc` it seems. Somehow the following files need to be included into `lib/qdp_map.cc`:\r\n\r\n- `include/qdp_primscalar.h`\r\n- `include/qdp_reality.h`\r\n- `include/qdp_primspinmat.h`\r\n- `include/qdp_outer.h`\r\n- `include/qdp_qdptype.h`\r\n\r\nIn order to quickly check whether all those are there, I added the following to `lib/qdp_map.cc`:\r\n\r\n```c++\r\n#if !defined(QDP_QDPTYPE_H) || !defined(QDP_PRIMSCALAR_H) \\                     \r\n     || !defined(QDP_REALITY_H) || !defined(QDP_PRIMSPINMAT_H) \\                \r\n     || !defined(QDP_OUTER_H)                                                    \r\n #error \"Not all includes are there.\"                                            \r\n#endif\r\n```\r\n\r\n`icpc` still complains about the “incomplete type”. Therefore the includes are there, but it still does not check out. I have added `-H` to the `icpc` call to see all the included files. All the files I have listed are properly included, so the error must be somewhere else.\r\n\r\nWhat am I doing wrong for the compilation?"}}
{"actor":{"display_login":"martin-ueding"}}