Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template arg list #208

Merged
merged 3 commits into from
Jan 11, 2025
Merged

Template arg list #208

merged 3 commits into from
Jan 11, 2025

Conversation

mgates3
Copy link
Collaborator

@mgates3 mgates3 commented Jan 11, 2025

Fixes #205.
This syntax is invalid but was long accepted by compilers:

    A.template listBcast( ... );

It is required to have <>:

    A.template listBcast<>( ... );

See C++ standard, Names of template specializations (§14.2 ¶5 in N3337 C++11 draft):

template <class T> void f(T t) {
  A<T> a;
  a.template f<>(t);  // OK: calls template
  a.template f(t);    // error: not a template-id
};

@mgates3
Copy link
Collaborator Author

mgates3 commented Jan 11, 2025

The Makefile fix for cleaning matgen arose because make distclean didn't remove the g++ compiled object files in order to recompile with clang++.

The ScaLAPACK tester fix arose because I don't have a clang-compatible ScaLAPACK library, so I compiled with SCALAPACK_LIBRARIES = none, but that one tester inadvertently required ScaLAPACK. The fix is just putting a compile guard and re-indenting code.

@mgates3
Copy link
Collaborator Author

mgates3 commented Jan 11, 2025

Before changes -- errors in compiling these files

slate> echo $OMPI_CC
clang

slate> echo $OMPI_CXX
clang++

slate> mpicxx --version
Homebrew clang version 19.1.5
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/19.1.5/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin22.cfg

slate> git idx
* 95a481cf 2024-12-28 10:11 Mark Gates  test: fix order of deleting arrays to resolve compiler warning (gcc 14.2)   (HEAD -> master, mgates/heev-check, github/master, scalapack, heev-check)

slate> git re -l '\w+\.template \w+\(' > b

slate> perl -pi -e 's/\.cc/.o/' b

slate> cat b
src/gbtrf.o
src/ge2tb.o
src/gelqf.o
src/gemmA.o
src/geqrf.o
src/gerbt.o
src/getri.o
src/he2hb.o
src/hetrf.o
src/pbtrf.o
src/tbsmPivots.o
src/trtrm.o
src/unmlq.o
src/unmqr.o
src/work/work_trsm.o

slate> make -j1 -k `cat b`
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/gbtrf.cc -o src/gbtrf.o
src/gbtrf.cc:118:28: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  118 |                 A.template listBcast(bcast_list_A, layout, tag_k);
      |                            ^
src/gbtrf.cc:193:32: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  193 |                     A.template listBcast(bcast_list_A, layout, tag_kl1);
      |                                ^
2 errors generated.
make: *** [GNUmakefile:1391: src/gbtrf.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/ge2tb.cc -o src/ge2tb.o
src/ge2tb.cc:234:38: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  234 |                     TUlocal.template listBcast(bcast_list_T, layout);
      |                                      ^
src/ge2tb.cc:248:39: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  248 |                     TUreduce.template listBcast(bcast_list_T, layout);
      |                                       ^
src/ge2tb.cc:383:42: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  383 |                         TVlocal.template listBcast(bcast_list_T, layout);
      |                                          ^
src/ge2tb.cc:397:43: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  397 |                         TVreduce.template listBcast(bcast_list_T, layout);
      |                                           ^
4 errors generated.
make: *** [GNUmakefile:1391: src/ge2tb.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/gelqf.cc -o src/gelqf.o
src/gelqf.cc:241:42: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  241 |                         Treduce.template listBcast(bcast_list_T, layout);
      |                                          ^
1 error generated.
make: *** [GNUmakefile:1391: src/gelqf.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/gemmA.cc -o src/gemmA.o
src/gemmA.cc:121:24: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  121 |             C.template listReduce( reduce_list_C, layout, tag_0 );
      |                        ^
src/gemmA.cc:183:28: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  183 |                 C.template listReduce( reduce_list_C, layout, tag_k );
      |                            ^
2 errors generated.
make: *** [GNUmakefile:1391: src/gemmA.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/geqrf.cc -o src/geqrf.o
src/geqrf.cc:194:42: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  194 |                         Treduce.template listBcast(bcast_list_T, layout);
      |                                          ^
1 error generated.
make: *** [GNUmakefile:1391: src/geqrf.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/gerbt.cc -o src/gerbt.o
src/gerbt.cc:184:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  184 |         U.template listBcastMT(bcast_list_U, Layout::ColMajor);
      |                    ^
src/gerbt.cc:185:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  185 |         V.template listBcastMT(bcast_list_V, Layout::ColMajor);
      |                    ^
src/gerbt.cc:300:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  300 |         U.template listBcastMT(bcast_list, Layout::ColMajor);
      |                    ^
3 errors generated.
make: *** [GNUmakefile:1391: src/gerbt.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/getri.cc -o src/getri.o
src/getri.cc:68:24: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
   68 |             W.template tileBcast(
      |                        ^
src/getri.cc:109:24: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  109 |             W.template listBcast(bcast_list_W, layout);
      |                        ^
src/getri.cc:127:24: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  127 |             A.template listReduce(reduce_list_A, layout);
      |                        ^
3 errors generated.
make: *** [GNUmakefile:1391: src/getri.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/he2hb.cc -o src/he2hb.o
src/he2hb.cc:245:42: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  245 |                         Treduce.template listBcastMT( bcast_list_T, layout );
      |                                          ^
1 error generated.
make: *** [GNUmakefile:1391: src/he2hb.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/hetrf.cc -o src/hetrf.o
src/hetrf.cc:446:32: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  446 |                     T.template listBcast(bcast_list_T, layout, tag);
      |                                ^
1 error generated.
make: *** [GNUmakefile:1391: src/hetrf.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/pbtrf.cc -o src/pbtrf.o
src/pbtrf.cc:99:28: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
   99 |                 A.template listBcast(bcast_list_A, layout);
      |                            ^
1 error generated.
make: *** [GNUmakefile:1391: src/pbtrf.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/tbsmPivots.cc -o src/tbsmPivots.o
src/tbsmPivots.cc:134:32: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  134 |                     A.template tileBcast(k, k, B.sub(k, k, 0, nt-1), layout);
      |                                ^
src/tbsmPivots.cc:218:32: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  218 |                     A.template tileBcast(k, k, B.sub(k, k, 0, nt-1), layout);
      |                                ^
src/tbsmPivots.cc:327:32: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  327 |                     A.template tileBcast(k, k, B.sub(k, k, 0, nt-1), layout);
      |                                ^
3 errors generated.
make: *** [GNUmakefile:1391: src/tbsmPivots.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/trtrm.cc -o src/trtrm.o
src/trtrm.cc:80:28: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
   80 |                 A.template listBcast(bcast_list_A, layout);
      |                            ^
1 error generated.
make: *** [GNUmakefile:1391: src/trtrm.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/unmlq.cc -o src/unmlq.o
src/unmlq.cc:154:37: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  154 |                     Tlocal.template listBcast(bcast_list_T, layout);
      |                                     ^
src/unmlq.cc:176:38: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  176 |                     Treduce.template listBcast(bcast_list_T, layout);
      |                                      ^
2 errors generated.
make: *** [GNUmakefile:1391: src/unmlq.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/unmqr.cc -o src/unmqr.o
src/unmqr.cc:158:37: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  158 |                     Tlocal.template listBcast(bcast_list_T, layout);
      |                                     ^
src/unmqr.cc:180:38: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  180 |                     Treduce.template listBcast(bcast_list_T, layout);
      |                                      ^
2 errors generated.
make: *** [GNUmakefile:1391: src/unmqr.o] Error 1
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/work/work_trsm.cc -o src/work/work_trsm.o
src/work/work_trsm.cc:109:28: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  109 |                 A.template tileBcast(k, k, B.sub(k, k, 0, nt-1), layout);
      |                            ^
src/work/work_trsm.cc:194:28: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  194 |                 A.template tileBcast(k, k, B.sub(k, k, 0, nt-1), layout);
      |                            ^
2 errors generated.
make: *** [GNUmakefile:1391: src/work/work_trsm.o] Error 1

After changes -- no errors

slate> git idx
* b7a231de 2025-01-10 21:46 Mark Gates  Fix calling template functions; error with clang 19. Resolves #205.   (HEAD -> template-arg-list, mgates/template-arg-list)

slate> make -j1 -k `cat b`
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/gbtrf.cc -o src/gbtrf.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/ge2tb.cc -o src/ge2tb.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/gelqf.cc -o src/gelqf.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/gemmA.cc -o src/gemmA.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/geqrf.cc -o src/geqrf.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/gerbt.cc -o src/gerbt.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/getri.cc -o src/getri.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/he2hb.cc -o src/he2hb.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/hetrf.cc -o src/hetrf.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/pbtrf.cc -o src/pbtrf.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/tbsmPivots.cc -o src/tbsmPivots.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/trtrm.cc -o src/trtrm.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/unmlq.cc -o src/unmlq.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/unmqr.cc -o src/unmqr.o
mpicxx -g -Wno-format-truncation -I/opt/homebrew/include -Wno-c99-extensions -Dslate_omp_default_none='default(none)' -O3 -std=c++17 -Wall -Wshadow -pedantic -MMD -fPIC -fopenmp -I./blaspp/include -I./lapackpp/include -I./include -I./src -c src/work/work_trsm.cc -o src/work/work_trsm.o

Copy link
Collaborator Author

@mgates3 mgates3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

@mgates3 mgates3 merged commit 8b8b03c into icl-utk-edu:master Jan 11, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with clang 19
1 participant