17 #include "../src/shared/util.h" 28 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
29 MPI_Comm_size(MPI_COMM_WORLD, &num_pes);
31 int order_A, order_B, order_C;
43 for (i=0; i<order_A; i++){
47 for (i=0; i<order_B; i++){
51 for (i=0; i<order_C; i++){
62 double st_time = MPI_Wtime();
64 for (i=0; i<niter; i++){
68 double end_time = MPI_Wtime();
71 printf(
"Performed %d iterations of C[\"%s\"] += A[\"%s\"]*B[\"%s\"] in %lf sec/iter\n",
72 niter, iC, iA, iB, (end_time-st_time)/niter);
80 char ** itr = std::find(begin, end, option);
81 if (itr != end && ++itr != end){
88 int main(
int argc,
char ** argv){
90 int const in_num = argc;
91 char ** input_str = argv;
96 MPI_Init(&argc, &argv);
97 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
98 MPI_Comm_size(MPI_COMM_WORLD, &np);
101 n = atoi(
getCmdOption(input_str, input_str+in_num,
"-n"));
105 if (
getCmdOption(input_str, input_str+in_num,
"-niter")){
106 niter = atoi(
getCmdOption(input_str, input_str+in_num,
"-niter"));
107 if (niter < 0) niter = 3;
char * getCmdOption(char **begin, char **end, const std::string &option)
an instance of the CTF library (world) on a MPI communicator
int main(int argc, char **argv)
an instance of a tensor within a CTF world
int bench_contraction(int n, int niter, char const *iA, char const *iB, char const *iC, CTF_World &dw)