27 A3[
"ij"] = 2.*A[
"ij"];
30 MPI_File_open(dw.
comm,
"CTF_checkpoint_test_file.bin", MPI_MODE_WRONLY | MPI_MODE_CREATE, MPI_INFO_NULL, &file);
33 MPI_File_close(&file);
35 MPI_File_open(dw.
comm,
"CTF_checkpoint_test_file.bin", MPI_MODE_RDONLY | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &file);
40 int pass = A.
norm2() <= 1.e-9*n;
43 MPI_File_close(&file);
44 A5[
"ij"] -= 2.*A4[
"ij"];
45 pass = pass & (A5.
norm2() <= 1.e-9*n);
49 printf(
"{ checkpointing using dense data representation with qtf=%d } failed\n",qtf);
51 printf(
"{ checkpointing using dense data representation with qtf=%d } passed\n",qtf);
63 char ** itr = std::find(begin, end, option);
64 if (itr != end && ++itr != end){
71 int main(
int argc,
char ** argv){
73 int const in_num = argc;
74 char ** input_str = argv;
76 MPI_Init(&argc, &argv);
77 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
78 MPI_Comm_size(MPI_COMM_WORLD, &np);
81 n = atoi(
getCmdOption(input_str, input_str+in_num,
"-n"));
86 qtf = atoi(
getCmdOption(input_str, input_str+in_num,
"-qtf"));
87 if (qtf < 0) qtf =
NS;
93 World dw(MPI_COMM_WORLD, argc, argv);
95 printf(
"Checking checkpoint calculation n = %d, p = %d, qtf = %d:\n",n,np,qtf);
Matrix class which encapsulates a 2D tensor.
int checkpoint(int n, World &dw, int qtf=NS)
an instance of the CTF library (world) on a MPI communicator
void write_dense_to_file(MPI_File &file, int64_t offset=0)
write all tensor data to binary file in element order, unpacking from sparse or symmetric formats ...
void read_dense_from_file(MPI_File &file, int64_t offset=0)
read all tensor data from binary file in element order, which should be stored as nonsymmetric and de...
dtype norm2()
computes the frobenius norm of the tensor (needs sqrt()!)
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 main(int argc, char **argv)
void print(FILE *fp, dtype cutoff) const
prints tensor data to file using process 0 (modify print(...) overload in set.h if you would like a d...
char * getCmdOption(char **begin, char **end, const std::string &option)
MPI_Comm comm
set of processors making up this world