26 {
27
28
31 util::io::print(fmt::format(
"Initialized MPI. MPI size = {}, MPI rank = {}\n", mpiSize, mpiRank));
33
35
36 if (input.cmdOptionExists("-h") or !input.cmdOptionExists("-i")) {
37
38 std::cout << "Syntax to run PeriDEM: PeriDEM -i <input file> -nThreads <number of threads>" << std::endl;
39 std::cout << "Example: PeriDEM -i input.yaml -nThreads 4" << std::endl;
40 exit(EXIT_FAILURE);
41 }
42
43 unsigned int nThreads;
44 if (input.cmdOptionExists("-nThreads")) nThreads = std::stoi(input.getCmdOption("-nThreads"));
45 else {
46 nThreads = std::thread::hardware_concurrency();
47 util::io::print(fmt::format(
"Running test with default number of threads = {}\n", nThreads));
48 }
49
52
53
54 std::cout << "PeriDEM"
57
58
59 auto begin = steady_clock::now();
60
61
62 std::string filename = input.getCmdOption("-i");
64
65
66 if (deck->isPeriDEM()) {
68 dem.run(deck);
69 } else {
70 std::cout << "PeriDEM model not found in input file.\n";
71 }
72
73
74 auto end = steady_clock::now();
75
76 std::cout << "Total simulation time (s) = "
78 << std::endl;
79}
size_t const MINOR_VERSION
size_t const UPDATE_VERSION
size_t const MAJOR_VERSION
A class for discrete element particle simulation with peridynamic model
std::string printStr(const T &msg, int nt=print_default_tab)
Returns formatted string for output.
void print(const T &msg, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
Prints formatted information.
float timeDiff(std::chrono::steady_clock::time_point begin, std::chrono::steady_clock::time_point end, std::string unit="microseconds")
Returns difference between two times.
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