13 #include <FrontISTRConfig.h>
46 MPI_Comm_size(MPI_COMM_WORLD, &proc);
55 return omp_get_max_threads();
65 void set_num_threads(
char *arg) {
69 fprintf(stderr,
"Error : specify number of OpenMP threads.\n");
70 fprintf(stderr,
"Format: -t <n>\n");
74 exec_threads = atoi(arg);
76 if (exec_threads == 0) {
77 fprintf(stderr,
"Error : specify 1 or more OpenMP threads.\n");
80 omp_set_num_threads(exec_threads);
82 mkl_set_num_threads(exec_threads);
92 printf(
"usage: [ mpirun -np <mpiprocs> ] fistr1 [options] \n");
93 printf(
" -h: Show this help message.\n");
94 printf(
" -v: Show version.\n");
96 printf(
" -t <n>: Set number of OpenMP threads\n");
98 printf(
" -c <Path of control file>: Use this control file. Default "
99 "./hecmw_ctrl.dat\n");
100 printf(
"--debug: Show debug messages.\n");
110 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
113 printf(
"##################################################################\n");
114 printf(
"# FrontISTR #\n");
115 printf(
"##################################################################\n");
117 if (VERSION_PATCH == 0){
118 printf(
"version: %d.%d\n", VERSION_MAJOR, VERSION_MINOR);
120 printf(
"version: %d.%d.%d\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
122 printf(
"git_hash: %s\n", GIT_HASH );
124 printf(
" date: %s\n", BUILD_DATE );
126 printf(
" MPI: \"%d.%d", MPI_VERSION, MPI_SUBVERSION);
127 #if defined(MVAPITCH2_VERSION)
128 printf(
", MVAPITCH %s", MVAPITCH2_VERSION);
129 #elif defined(I_MPI_VERSION)
130 printf(
", Intel MPI %s", I_MPI_VERSION);
131 #elif defined(MSMPI_VER)
132 printf(
", Microsoft MPI");
133 #elif defined(MPI_NEC_MODE_GETPUTALIGNED)
135 #elif defined(MPICH_VERSION)
136 printf(
", MPICH %s", MPICH_VERSION);
137 #elif defined(OMPI_MAJOR_VERSION)
138 printf(
", Open MPI %d.%d.%d", OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, OMPI_RELEASE_VERSION);
142 printf(
" MPI: disabled\n");
145 printf(
" OpenMP: %d\n", _OPENMP);
147 printf(
" OpenMP: disabled\n");
150 printf(
" OpenACC: %d\n", _OPENACC);
152 printf(
" OpenACC: disabled\n");
160 printf(
"--with-tools ");
163 printf(
"--with-refiner ");
166 printf(
"--with-metis ");
169 printf(
"--with-mumps ");
172 printf(
"--with-lapack ");
175 printf(
"--with-ml ");
178 printf(
"--with-parmetis ");
181 printf(
"--with-mkl ");
184 printf(
"--with-netcdf ");
188 #ifdef HECMW_METIS_VER
189 printf(
" HECMW_METIS_VER: %d\n", HECMW_METIS_VER);
198 int proc, i, len, mpi_ver, mpi_subver;
204 char hostname[MPI_MAX_PROCESSOR_NAME];
205 char mpilibver[MPI_MAX_LIBRARY_VERSION_STRING];
207 MPI_Comm_size(MPI_COMM_WORLD, &proc);
208 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
209 MPI_Get_version(&mpi_ver, &mpi_subver);
210 MPI_Get_library_version(mpilibver,&len);
212 while ((p = strchr(mpilibver,
'\n')) !=
NULL) *p =
'\0';
213 MPI_Get_processor_name(hostname, &len);
219 printf(
"execute: \n");
222 d=(int)difftime(t,mktime(gmtime(&t)));
223 strftime(date,
sizeof(date),
"%Y-%m-%dT%H:%M:%S", localtime(&t));
224 printf(
" date: %s", date);
225 if (abs(d)<86400) printf(
"%+05d", (
int)(d/3600)*100+(
int)(d/60)%60);
231 printf(
" MPI: \"%d.%d, %.128s\"\n", mpi_ver, mpi_subver, mpilibver);
238 printf(
" %d: %s\n",0,hostname);
239 for (i=1;i<proc;i++){
240 MPI_Recv(&hostname,
sizeof(hostname), MPI_CHAR, i, 0, MPI_COMM_WORLD, &status);
241 printf(
" %d: %s\n",i,hostname);
244 MPI_Send(&hostname, len, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
247 gethostname(hostname,
sizeof(hostname));
248 printf(
" %d: %s\n",0,hostname);
250 if (rank==0) printf(
"---\n");
259 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
262 if (rank==0) printf(
"---\n");
270 fprintf(stderr,
"Sorry this option cannot work yet. (-c)\n");
271 fprintf(stderr,
"%s\n", arg);
292 {
"-t", set_num_threads},
293 {
"-T", set_num_threads},
304 int main(
int argc,
char *argv[])
310 MPI_Init(&argc, &argv);
313 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
314 const int ngpus = acc_get_num_devices(acc_device_nvidia);
315 if (ngpus == 0 && rank == 0) {
316 fprintf(stdout,
"No GPU devices found.\n");
318 const int gpuid = ngpus > 0 ? rank % ngpus : -1;
320 acc_set_device_num(gpuid, acc_device_nvidia);
324 for (i = 0; i < argc; i++) {
327 p->
func(argv[i + 1]);
334 MPI_Barrier( MPI_COMM_WORLD );
void HECMW_setloglv(int loglv)
int main(int argc, char *argv[])
main function
void help(char *arg)
show available command line option
void print_executeinfo(int log_level)
show execute environment information
void set_loglevel_debug(char *arg)
set log level to HECMW_LOG_DEBUG
void fstr_main()
Startup routine for FrontISTR.
void version(char *arg)
show version and revision of FrontISTR
struct option_rec options[]
specify command line option name and executing function name.
void load_hecmw_ctrl(char *arg)
load hecmw_ctrl.dat from specified place
void print_buildinfo(int log_level)
show build information
struct of command-line option