15#include <fmt/format.h>
18int main(
int argc,
char *argv[]) {
23 util::io::print(fmt::format(
"Initialized MPI. MPI size = {}, MPI rank = {}\n", mpiSize, mpiRank));
36 <<
") -o <test-option; 0 - taskflow, 1 - parallel on in-built mesh, 2 - user-defined mesh>"
37 " -i <vector-size> -n <grid-size>"
38 " -m <horizon-integer-factor>"
39 " -nThreads <number of threads to be used in taskflow>" << std::endl;
40 std::cout <<
"To test taskflow, run\n";
41 std::cout << argv[0] <<
" -o 0 -i 10000"
42 " -nThreads <number of threads to be used in taskflow>\n";
43 std::cout <<
"To test parallel using in-built mesh, run\n";
44 std::cout << argv[0] <<
" -o 1 -m 4 -n 50\n";
45 std::cout <<
"To test parallel on user-provided mesh (filename = filepath/meshfile.vtu)" << std::endl;
46 std::cout << argv[0] <<
" -o 2 -m 4 -f filepath/meshfile.vtu" << std::endl;
51 size_t testOption(-1);
56 if (testOption == 0) {
63 util::io::print(fmt::format(
"Running test with default vector-size = {}\n", nTaskflow));
66 unsigned int nThreads;
69 nThreads = std::thread::hardware_concurrency();
70 util::io::print(fmt::format(
"Running test with default number of threads = {}\n", nThreads));
76 std::vector<size_t> N_test = {size_t(nTaskflow/100), size_t(nTaskflow/10), nTaskflow, 10*nTaskflow, 100*nTaskflow};
78 size_t test_count = 0;
79 for (
auto n : N_test) {
81 "Test parameters: N = {}\n\n",
86 }
else if (testOption == 1 or testOption == 2) {
91 std::cout <<
"\nNo tests for mpiSize = 1. Skipping this test.\n\n";
94 size_t nGrid(0), mHorizon;
95 std::string meshFilename(
"");
101 if (testOption == 1) {
103 util::io::print(fmt::format(
"Running test with default grid size = {}\n", nGrid));
111 util::io::print(fmt::format(
"Running test with default integer factor for horizon = {}\n", mHorizon));
118 if ((nGrid > 0 and testOption == 2) or
119 (!meshFilename.empty() and testOption == 1)) {
121 <<
"Please specify either using uniform mesh (in-built) or user-defined mesh "
122 "to perform the MPI test. "
123 "That is, either specify '-o 1 -n <grid-size>' "
124 "or '-o 2 -f <mesh-filename>'.\n";
size_t const MINOR_VERSION
size_t const UPDATE_VERSION
size_t const MAJOR_VERSION
std::string testTaskflow(size_t N, int seed)
Perform test on taskflow.
void testMPI(size_t nGrid=10, size_t mHorizon=3, size_t testOption=0, std::string meshFilename="")
Perform parallelization test using MPI on mesh partition based on metis.
void print(const T &msg, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
Prints formatted information.
void initLogger(int debug_level=logger_default_debug_lvl, std::string filename="")
Initializes the logger.
unsigned int getNThreads()
Get number of threads to be used by taskflow.
void initNThreads(unsigned int nThreads=std::thread::hardware_concurrency())
Initializes MpiStatus struct.
const MpiStatus * getMpiStatus()
Returns pointer to MpiStatus struct.
void initMpi(int argc=0, char *argv[]=nullptr)
Initializes MPI and also creates MpiStatus struct.
int mpiSize()
Get size (number) of processors.
int mpiRank()
get rank (id) of this processor