1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-04 19:25:56 +01:00

Fix non-zero ret on device bug

This commit is contained in:
Julian Lenz 2023-06-16 16:27:49 +01:00
parent 8c3792721b
commit 621e612c30

View File

@ -1,55 +1,65 @@
#include <Grid/Grid.h> #include <Grid/Grid.h>
#include <iostream>
using namespace Grid; using namespace Grid;
template <int ncolour> template <int ngroup>
void run_checks(bool print_generators = 0) { std::ostream& operator<<(std::ostream& o, Sp<ngroup> g) {
return o << "Sp(" << ngroup << ") Fundamental";
}
template <int ngroup, TwoIndexSymmetry S>
std::ostream& operator<<(std::ostream& o, Sp_TwoIndex<ngroup, S> g) {
return o << "Sp(" << ngroup << ") TwoIndex "
<< (S == Symmetric ? "Symmetric" : "AntiSymmetric");
}
template <class Group>
void run_check_on(bool print_generators = false) {
std::cout << GridLogMessage << "*********************************************" std::cout << GridLogMessage << "*********************************************"
<< std::endl; << std::endl;
std::cout << GridLogMessage << "* Generators for Sp(" << ncolour << ")" std::cout << GridLogMessage << "* Generators for " << Group() << std::endl;
<< "Fundamental" << std::endl;
std::cout << GridLogMessage << "*********************************************" std::cout << GridLogMessage << "*********************************************"
<< std::endl; << std::endl;
if (print_generators) { if (print_generators) {
Sp<ncolour>::printGenerators(); Group::printGenerators();
} }
Sp<ncolour>::testGenerators(); Group::testGenerators();
}
if (Sp_TwoIndex<ncolour, Symmetric>::Dimension > 1) { template <int ngroup>
std::cout << GridLogMessage void run_checks() {
<< "*********************************************" << std::endl; run_check_on<Sp<ngroup>>();
std::cout << GridLogMessage << "* Generators for Sp(" << ncolour << ")" run_check_on<Sp_TwoIndex<ngroup, Symmetric>>();
<< "TwoIndex Symmetric: " << std::endl; run_check_on<Sp_TwoIndex<ngroup, AntiSymmetric>>();
std::cout << GridLogMessage }
<< "*********************************************" << std::endl;
if (print_generators) {
Sp_TwoIndex<ncolour, Symmetric>::printGenerators();
}
Sp_TwoIndex<ncolour, Symmetric>::testGenerators();
}
if (Sp_TwoIndex<ncolour, AntiSymmetric>::Dimension > 1) { template <>
std::cout << GridLogMessage void run_checks<2>() {
<< "*********************************************" << std::endl; // Print generators because they are small enough to be actually helpful.
std::cout << GridLogMessage << "* Generators for Sp(" << ncolour << ")" run_check_on<Sp<2>>(true);
<< "TwoIndex AntiSymmetric: " << std::endl; run_check_on<Sp_TwoIndex<2, Symmetric>>(true);
std::cout << GridLogMessage // The AntiSymmetric representation is 0 dimensional. This makes problems in
<< "*********************************************" << std::endl; // device code.
if (print_generators) { }
Sp_TwoIndex<ncolour, AntiSymmetric>::printGenerators();
} template <>
Sp_TwoIndex<ncolour, AntiSymmetric>::testGenerators(); void run_checks<4>() {
} // Print generators because they are small enough to be actually helpful.
run_check_on<Sp<4>>(true);
run_check_on<Sp_TwoIndex<4, Symmetric>>(true);
run_check_on<Sp_TwoIndex<4, AntiSymmetric>>(true);
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
Grid_init(&argc, &argv); Grid_init(&argc, &argv);
run_checks<2>(1); // check and print Nc=2 run_checks<2>();
run_checks<4>(1); // check and print Nc=4 run_checks<4>();
run_checks<6>(); // check Nc=6 run_checks<6>();
run_checks<8>(); // check Nc=8 run_checks<8>();
Grid_finalize(); Grid_finalize();
} }