20 int shapeN4[] = {
NS,
NS,
NS,NS};
21 int sizeN4[] = {n+1,n,n+2,n+3};
29 double * all_start_data;
37 .25*A[
"ijkl"]+=ufun(.75*A[
"ijkl"]);
39 double * all_end_data;
43 int pass = (nall == nall2);
45 for (int64_t i=0; i<nall; i++){
46 if (fabs(.25*all_start_data[i]+
fquad(.75*all_start_data[i])-all_end_data[i])>=1.E-6) pass =0;
49 MPI_Allreduce(MPI_IN_PLACE, &pass, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
53 printf(
"{ A[\"ijkl\"] = A[\"ijkl\"]^3 } passed\n");
55 printf(
"{ A[\"ijkl\"] = A[\"ijkl\"]^3 } failed\n");
59 delete [] all_start_data;
60 delete [] all_end_data;
71 char ** itr = std::find(begin, end, option);
72 if (itr != end && ++itr != end){
79 int main(
int argc,
char ** argv){
81 int const in_num = argc;
82 char ** input_str = argv;
84 MPI_Init(&argc, &argv);
85 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
86 MPI_Comm_size(MPI_COMM_WORLD, &np);
89 n = atoi(
getCmdOption(input_str, input_str+in_num,
"-n"));
95 World dw(MPI_COMM_WORLD, argc, argv);
98 printf(
"Computing univar_function A_ijkl = f(A_ijkl)\n");
int main(int argc, char **argv)
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
int univar_function(int n, World &dw)
an instance of a tensor within a CTF world
char * getCmdOption(char **begin, char **end, const std::string &option)