13 void f3(
double a,
double b,
double & c){
20 int shapeN4[] = {
NS,
NS,
NS,NS};
21 int sizeN4[] = {n+1,n,n+2,n+3};
33 double * all_start_data_A;
35 A.
read_all(&nall_A, &all_start_data_A);
36 double * all_start_data_B;
38 B.
read_all(&nall_B, &all_start_data_B);
39 double * all_start_data_C;
41 C.
read_all(&nall_C, &all_start_data_C);
44 bfun(A[
"ijkl"],B[
"ijkl"],C[
"ijkl"]);
46 double * all_end_data_C;
48 C.
read_all(&nall2_C, &all_end_data_C);
50 int pass = (nall_C == nall2_C);
52 for (int64_t i=0; i<nall_A; i++){
53 double k = all_start_data_C[i];
54 f3(all_start_data_A[i],all_start_data_B[i], k);
55 if (fabs(k-all_end_data_C[i])>=1.E-6){
57 printf(
" %lf %lf %lf %lf %lf\n",all_start_data_A[i],all_start_data_B[i],all_start_data_C[i],k,all_end_data_C[i]);
61 MPI_Allreduce(MPI_IN_PLACE, &pass, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
65 printf(
"{ f3(A[\"ijkl\"], B[\"ijkl\"], C[\"ijkl\"]) } passed\n");
67 printf(
"{ f3(A[\"ijkl\"], B[\"ijkl\"], C[\"ijkl\"]) } failed\n");
71 delete [] all_start_data_A;
72 delete [] all_start_data_B;
73 delete [] all_start_data_C;
74 delete [] all_end_data_C;
85 char ** itr = std::find(begin, end, option);
86 if (itr != end && ++itr != end){
93 int main(
int argc,
char ** argv){
95 int const in_num = argc;
96 char ** input_str = argv;
98 MPI_Init(&argc, &argv);
99 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
100 MPI_Comm_size(MPI_COMM_WORLD, &np);
103 n = atoi(
getCmdOption(input_str, input_str+in_num,
"-n"));
109 World dw(MPI_COMM_WORLD, argc, argv);
112 printf(
"Computing bivar_transform A_ijkl = f(A_ijkl)\n");
void read_all(int64_t *npair, dtype **data, bool unpack=false)
collects the entire tensor data on each process (not memory scalable)
an instance of the CTF library (world) on a MPI communicator
void fill_random(dtype rmin, dtype rmax)
fills local unique tensor elements to random values in the range [min,max] works only for dtype in {f...
int rank
rank of local processor
an instance of a tensor within a CTF world