29 #include "../examples/trace.cxx" 30 #include "../examples/dft_3D.cxx" 31 #include "../examples/strassen.cxx" 32 #include "../examples/recursive_matmul.cxx" 33 #include "../examples/force_integration.cxx" 34 #include "../examples/force_integration_sparse.cxx" 35 #include "../examples/particle_interaction.cxx" 36 #include "../examples/spmv.cxx" 37 #include "../examples/jacobi.cxx" 38 #include "../examples/sssp.cxx" 39 #include "../examples/apsp.cxx" 40 #include "../examples/btwn_central.cxx" 41 #include "../examples/sparse_mp3.cxx" 42 #include "../examples/bitonic_sort.cxx" 43 #include "../examples/matmul.cxx" 45 #include "../studies/fast_sym.cxx" 46 #include "../studies/fast_sym_4D.cxx" 49 #include "../scalapack_tests/qr.cxx" 50 #include "../scalapack_tests/svd.cxx" 63 char ** itr = std::find(begin, end, option);
64 if (itr != end && ++itr != end){
71 int main(
int argc,
char ** argv){
74 char ** input_str = argv;
78 MPI_Init(&argc, &argv);
79 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
80 MPI_Comm_size(MPI_COMM_WORLD, &np);
83 n = atoi(
getCmdOption(input_str, input_str+in_num,
"-n"));
88 printf(
"Testing Cyclops Tensor Framework using %d processors\n",np);
91 std::vector<int> pass;
94 World dw(MPI_COMM_WORLD, argc, argv);
97 printf(
"Testing non-symmetric: NS = NS*NS weigh with n = %d:\n",n);
101 printf(
"Testing symmetric: SY = SY*SY weigh with n = %d:\n",n);
105 printf(
"Testing (anti-)skew-symmetric: AS = AS*AS weigh with n = %d:\n",n);
109 printf(
"Testing symmetric-hollow: SH = SH*SH weigh with n = %d:\n",n);
113 printf(
"Testing CCSDT T3->T2 with n= %d, m = %d:\n",n,n+1);
117 printf(
"Testing non-symmetric: NS = NS*NS matmul with n = %d:\n",n*n);
118 pass.push_back(
matmul(n*n, n*n, n*n, dw));
121 printf(
"Testing symmetric: SY = SY*SY matmul with n = %d:\n",n*n);
125 printf(
"Testing (anti-)skew-symmetric: AS = AS*AS matmul with n = %d:\n",n*n);
129 printf(
"Testing symmetric-hollow: SH = SH*SH matmul with n = %d:\n",n*n);
133 printf(
"Testing non-symmetric: NS = NS*NS 4D gemm with n = %d:\n",n);
137 printf(
"Testing symmetric: SY = SY*SY 4D gemm with n = %d:\n",n);
141 printf(
"Testing (anti-)skew-symmetric: AS = AS*AS 4D gemm with n = %d:\n",n);
145 printf(
"Testing symmetric-hollow: SH = SH*SH 4D gemm with n = %d:\n",n);
149 printf(
"Testing scalar operations\n");
150 pass.push_back(
scalar(dw));
153 printf(
"Testing a 2D trace operation with n = %d:\n",n);
154 pass.push_back(
trace(n, dw));
157 printf(
"Testing a diag sym operation with n = %d:\n",n);
161 printf(
"Testing a diag ctr operation with n = %d m = %d:\n",n,n*n);
162 pass.push_back(
diag_ctr(n, n*n, dw));
165 printf(
"Testing fast symmetric multiplication operation with n = %d:\n",n*n);
169 printf(
"Testing 4D fast symmetric contraction operation with n = %d:\n",n);
173 printf(
"Testing multi-tensor symmetric contraction with m = %d n = %d:\n",n*n,n);
177 printf(
"Testing gemm on subworld algorithm with n,m,k = %d div = 3:\n",n*n);
181 printf(
"Testing non-symmetric Strassen's algorithm with n = %d:\n", 2*n*n);
185 printf(
"Testing diagonal write with n = %d:\n",n);
189 printf(
"Testing readall test with n = %d m = %d:\n",n,n*n);
193 printf(
"Testing repack with n = %d:\n",n);
194 pass.push_back(
repack(n,dw));
197 printf(
"Testing SY times NS with n = %d:\n",n);
202 printf(
"Testing QR with m = %d n = %d:\n",n*n,n);
203 pass.push_back(
test_qr(n*n,n,dw));
206 printf(
"Testing SVD with m = %d n = %d k=%d:\n",n*n,n+1,n+1);
207 pass.push_back(
test_svd(n*n,n+1,n+1,dw));
210 if (np == 1<<(
int)log2(np)){
212 printf(
"Testing non-symmetric sliced GEMM algorithm with (%d %d %d):\n",16,32,8);
216 printf(
"Testing 1D DFT with n = %d:\n",n*n);
223 printf(
"Testing 3D DFT with n = %d:\n",n);
228 printf(
"Testing sparse summation with n = %d:\n",n);
232 printf(
"Testing sparse identity with n = %d order = %d:\n",n,11);
233 pass.push_back(
speye(n,11,dw));
236 printf(
"Testing endomorphism A_ijkl = A_ijkl^3 with n = %d:\n",n);
240 printf(
"Testing endomorphism with custom function on a monoid A_ijkl = f(A_ijkl) with n = %d:\n",n);
244 printf(
"Testing endomorphism with custom function on a sparse set A_ijkl = f(A_ijkl) with n = %d:\n",n);
248 printf(
"Testing univar_function .5*A_ijkl = .5*A_ijkl^4 with n = %d:\n",n);
252 printf(
"Testing force_integration integrates forces to particles with n = %d:\n",n);
256 printf(
"Testing force_integration_sparse integrates sparse forces to particles with n = %d:\n",n);
260 printf(
"Testing bivar_function A_ijkl = f2(A_ijkl, B_ijkl) with n = %d:\n",n);
264 printf(
"Testing custom bivar_function F[\"i\"] += f(P[\"i\"],P[\"j\"] with n = %d:\n",n);
268 printf(
"Testing bivar_transform 3(A_ijkl, B_ijkl, C_ijkl) with n = %d:\n",n);
272 printf(
"Testing sparse-matrix times vector with n=%d:\n",n);
273 pass.push_back(
spmv(n,dw));
276 printf(
"Testing sparse-matrix times matrix with n=%d k=%d:\n",n*n,n);
280 printf(
"Testing sparse-matrix times sparse-matrix with m=%d n=%d k=%d:\n",n,n*n,n+1);
284 printf(
"Testing sparse=sparse*sparse (spgemm) with m=%d n=%d k=%d:\n",n,n*n,n+1);
288 printf(
"Testing Jacobi iteration with n=%d:\n",n);
289 pass.push_back(
jacobi(n,dw));
292 printf(
"Testing SSSP via the Bellman-Ford algorithm n=%d:\n",n*n);
293 pass.push_back(
sssp(n*n,dw));
296 printf(
"Testing APSP via path doubling with n=%d:\n",n*n);
297 pass.push_back(
apsp(n*n,dw));
300 printf(
"Testing betweenness centrality with n=%d:\n",n);
301 pass.push_back(
btwn_cnt(n,dw,.2,2,1,1,1,1));
304 printf(
"Testing MP3 calculation using sparse*dense with %d occupied and %d virtual orbitals:\n",n,2*n);
305 pass.push_back(
sparse_mp3(2*n,n,dw,.8,1,0,0,0,0));
308 printf(
"Testing MP3 calculation using sparse*sparse with %d occupied and %d virtual orbitals:\n",n,2*n);
309 pass.push_back(
sparse_mp3(2*n,n,dw,.8,1,0,0,0,1));
316 int num_pass = std::accumulate(pass.begin(), pass.end(), 0);
318 printf(
"Testing completed, %d/%zu tests passed\n", num_pass, pass.size());
320 int64_t max_tot_mem_used;
321 MPI_Reduce(&tot_mem_used, &max_tot_mem_used, 1, MPI_INT64_T, MPI_MAX, 0, MPI_COMM_WORLD);
322 if (rank == 0 && max_tot_mem_used > 0)
323 printf(
"Warning: CTF memory accounting thinks %1.2E bytes have been left allocated, memory leak or bug possible\n", (
double)max_tot_mem_used);
int test_dft_3D(int n, World &wrld)
int diag_ctr(int n, int m, World &dw)
char * getCmdOption(char **begin, char **end, const std::string &option)
int jacobi(int n, World &dw)
int weigh_4D(int const n, int const sym, World &dw)
int spmv(int n, World &dw)
int sparse_mp3(int nv, int no, World &dw, double sp=.8, bool test=1, int niter=0, bool bnd=1, bool bns=1, bool sparse_T=1)
int main(int argc, char **argv)
int bivar_function(int n, World &dw)
int trace(int const n, World &dw)
int btwn_cnt(int n, World &dw, double sp=.20, int bsize=2, int nbatches=1, int test=0, bool sp_B=1, bool sp_C=1)
int force_integration_sparse(int n, World &dw)
int endomorphism_cust(int n, World &dw)
an instance of the CTF library (world) on a MPI communicator
int particle_interaction(int n, World &dw)
int endomorphism_cust_sp(int n, World &dw)
int scalar(CTF::World &dw)
int test_subworld_gemm(int n, int m, int k, int div_, World &dw)
int endomorphism(int n, World &dw)
int gemm_4D(int const n, int const sym, int const niter, World &dw)
int readwrite_test(int n, World &dw)
int sptensor_sum(int n, World &dw)
int matmul(int m, int n, int k, World &dw, int sym_A=NS, int sym_B=NS, int sym_C=NS, double sp_A=1., double sp_B=1., double sp_C=1., bool test=true, bool bench=false, int niter=10)
(if test) tests and (if bench) benchmarks m*n*k matrix multiplication with matrices of specified symm...
int force_integration(int n, World &dw)
int diag_sym(int n, World &dw)
bool test_svd(int m, int n, int k, World dw)
int speye(int n, int order, World &dw)
int sssp(int n, World &dw)
int readall_test(int n, int m, World &dw)
int64_t proc_bytes_used()
gives total memory used on this MPI process
int fast_sym_4D(int const n, World &ctf)
int multi_tsr_sym(int m, int n, World &dw)
int ccsdt_t3_to_t2(int n, int m, World &dw)
int fast_sym(int const n, World &ctf)
int univar_function(int n, World &dw)
int strassen(int const n, int const sym, World &dw)
int test_dft(int64_t n, World &wrld)
bool test_qr(int m, int n, World dw)
int repack(int n, World &dw)
int sy_times_ns(int n, World &dw)
int test_recursive_matmul(int n, int m, int k, World &dw)
int apsp(int n, World &dw, int niter=0)