ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
parallel_reduce_test.cpp File Reference
#include "source_base/parallel_reduce.h"
#include "mpi.h"
#include "source_base/parallel_global.h"
#include "gtest/gtest.h"
#include <assert.h>
#include <random>
#include <time.h>
Include dependency graph for parallel_reduce_test.cpp:

Classes

class  MPIContext
class  ParaReduce

Functions

template<typename T>
T * get_rand_array (int num, int my_rank)
 TEST_F (ParaReduce, ReduceIntAll)
 TEST_F (ParaReduce, ReduceDoubleAll)
 TEST_F (ParaReduce, ReduceComplexAll)
 TEST_F (ParaReduce, ReduceAdditionalTypesAll)
 TEST_F (ParaReduce, GatherIntAll)
 TEST_F (ParaReduce, GatherDoubleAll)
 TEST_F (ParaReduce, ReduceDoubleDiag)
 TEST_F (ParaReduce, ReduceDoubleGrid)
 TEST_F (ParaReduce, ReduceDoublePool)
 TEST_F (ParaReduce, ReduceComplexPool)
 TEST_F (ParaReduce, GatherDoublePool)
int main (int argc, char **argv)

Variables

const int MIN_FOR_RAND = 1
const int MAX_FOR_RAND = 99999

Function Documentation

◆ get_rand_array()

template<typename T>
T * get_rand_array ( int num,
int my_rank )
Here is the caller graph for this function:

◆ main()

int main ( int argc,
char ** argv )

◆ TEST_F() [1/11]

TEST_F ( ParaReduce ,
GatherDoubleAll  )

printf("post rank %d array[%d] = %f, min = %f, max = %f \n", my_rank,i,array[i],min_number,max_number);

Here is the call graph for this function:

◆ TEST_F() [2/11]

TEST_F ( ParaReduce ,
GatherDoublePool  )

num_per_process = 1;

printf("post rank %d, pool rank %d, array[%d] = %f, min = %f, max = %f \n", my_rank,mpiContext.rank_in_pool,i,array[i],min_number,max_number);

Here is the call graph for this function:

◆ TEST_F() [3/11]

TEST_F ( ParaReduce ,
GatherIntAll  )

printf("post rank %d array[%d] = %d, min = %d \n", my_rank,i,array[i],min_number);

Here is the call graph for this function:

◆ TEST_F() [4/11]

TEST_F ( ParaReduce ,
ReduceAdditionalTypesAll  )
Here is the call graph for this function:

◆ TEST_F() [5/11]

TEST_F ( ParaReduce ,
ReduceComplexAll  )

printf("pre rank %d rand_array[%d] = (%f,%f) \n",my_rank,i, rand_array[i].real(), rand_array[i].imag());

printf("pos rank %d rand_array[%d] = (%f,%f) \n",my_rank,i, rand_array[i].real(), rand_array[i].imag());

printf("rank %d sum1 = (%f,%f) sum2 = (%f,%f)\n",my_rank, global_sum_first.real(), global_sum_first.imag(), global_sum_second.real(), global_sum_second.imag());

Here is the call graph for this function:

◆ TEST_F() [6/11]

TEST_F ( ParaReduce ,
ReduceComplexPool  )

num_per_process = 1;

printf("word_rank/world_size = %d/%d, pool_rank/pool_size = %d/%d \n", my_rank,nproc, mpiContext.rank_in_pool,mpiContext.nproc_in_pool);

printf("pre rank %d rand_array[%d] = (%f,%f) \n",my_rank,i, rand_array[i].real(), rand_array[i].imag());

printf("pos rank %d rand_array[%d] = (%f,%f) \n",my_rank,i, rand_array[i].real(), rand_array[i].imag());

printf("rank %d sum1 = (%f,%f) sum2 = (%f,%f)\n",my_rank, pool_sum_first.real(), pool_sum_first.imag(), pool_sum_second.real(), pool_sum_second.imag());

Here is the call graph for this function:

◆ TEST_F() [7/11]

TEST_F ( ParaReduce ,
ReduceDoubleAll  )

printf("rank %d sum1 = %f, sum2 = %f\n",my_rank, global_sum_first, global_sum_second);

Here is the call graph for this function:

◆ TEST_F() [8/11]

TEST_F ( ParaReduce ,
ReduceDoubleDiag  )

num_per_process = 1;

printf(" pre world_rank %d, drank %d rand_array[%d] = %f\n", my_rank,mpiContext.dsize,i, rand_array[i]);

printf(" post world_rank %d, drank %d rand_array[%d] = %f\n", my_rank,mpiContext.dsize,i, rand_array[i]);

printf("world_rank %d, drank %d sum1 = %f, sum2 = %f\n", my_rank,mpiContext.dsize,diag_sum_first, diag_sum_second);

Here is the call graph for this function:

◆ TEST_F() [9/11]

TEST_F ( ParaReduce ,
ReduceDoubleGrid  )

num_per_process = 1;

printf(" pre world_rank %d, drank %d rand_array[%d] = %f\n", my_rank,mpiContext.dsize,i, rand_array[i]);

printf(" post world_rank %d, drank %d rand_array[%d] = %f\n", my_rank,mpiContext.dsize,i, rand_array[i]);

printf("world_rank %d, drank %d sum1 = %f, sum2 = %f\n", my_rank,mpiContext.dsize,grid_sum_first, grid_sum_second);

Here is the call graph for this function:

◆ TEST_F() [10/11]

TEST_F ( ParaReduce ,
ReduceDoublePool  )

num_per_process = 1;

printf("word_rank/world_size = %d/%d, pool_rank/pool_size = %d/%d \n", my_rank,nproc, mpiContext.rank_in_pool,mpiContext.nproc_in_pool);

printf("pool rank %d sum1 = %f, sum2 = %f\n",my_rank, pool_sum_first, pool_sum_second);

printf("global rank %d sum1 = %f, sum2 = %f\n",my_rank, global_sum_first, global_sum_second);

Here is the call graph for this function:

◆ TEST_F() [11/11]

TEST_F ( ParaReduce ,
ReduceIntAll  )

printf("rank %d sum1 = %d, sum2 = %d\n",my_rank, global_sum_first, global_sum_second);

Here is the call graph for this function:

Variable Documentation

◆ MAX_FOR_RAND

const int MAX_FOR_RAND = 99999

◆ MIN_FOR_RAND

const int MIN_FOR_RAND = 1