13 #include <FrontISTRConfig.h>
43 MPI_Comm_size(MPI_COMM_WORLD, &proc);
52 return omp_get_max_threads();
62 void set_num_threads(
char *arg) {
66 fprintf(stderr,
"Error : specify number of OpenMP threads.\n");
67 fprintf(stderr,
"Format: -t <n>\n");
71 exec_threads = atoi(arg);
73 if (exec_threads == 0) {
74 fprintf(stderr,
"Error : specify 1 or more OpenMP threads.\n");
77 omp_set_num_threads(exec_threads);
79 mkl_set_num_threads(exec_threads);
89 printf(
"usage: [ mpirun -np <mpiprocs> ] fistr1 [options] \n");
90 printf(
" -h: Show this help message.\n");
91 printf(
" -v: Show version.\n");
93 printf(
" -t <n>: Set number of OpenMP threads\n");
95 printf(
" -c <Path of control file>: Use this control file. Default "
96 "./hecmw_ctrl.dat\n");
97 printf(
"--debug: Show debug messages.\n");
107 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
110 printf(
"##################################################################\n");
111 printf(
"# FrontISTR #\n");
112 printf(
"##################################################################\n");
114 if (VERSION_PATCH == 0){
115 printf(
"version: %d.%d\n", VERSION_MAJOR, VERSION_MINOR);
117 printf(
"version: %d.%d.%d\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
119 printf(
"git_hash: %s\n", GIT_HASH );
121 printf(
" date: %s\n", BUILD_DATE );
123 printf(
" MPI: \"%d.%d", MPI_VERSION, MPI_SUBVERSION);
124 #if defined(MVAPITCH2_VERSION)
125 printf(
", MVAPITCH %s", MVAPITCH2_VERSION);
126 #elif defined(I_MPI_VERSION)
127 printf(
", Intel MPI %s", I_MPI_VERSION);
128 #elif defined(MSMPI_VER)
129 printf(
", Microsoft MPI");
130 #elif defined(MPI_NEC_MODE_GETPUTALIGNED)
132 #elif defined(MPICH_VERSION)
133 printf(
", MPICH %s", MPICH_VERSION);
134 #elif defined(OMPI_MAJOR_VERSION)
135 printf(
", Open MPI %d.%d.%d", OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, OMPI_RELEASE_VERSION);
139 printf(
" MPI: disabled\n");
142 printf(
" OpenMP: %d\n", _OPENMP);
144 printf(
" OpenMP: disabled\n");
152 printf(
"--with-tools ");
155 printf(
"--with-refiner ");
158 printf(
"--with-metis ");
161 printf(
"--with-mumps ");
164 printf(
"--with-lapack ");
167 printf(
"--with-ml ");
170 printf(
"--with-parmetis ");
173 printf(
"--with-mkl ");
176 printf(
"--with-netcdf ");
180 #ifdef HECMW_METIS_VER
181 printf(
" HECMW_METIS_VER: %d\n", HECMW_METIS_VER);
190 int proc, i, len, mpi_ver, mpi_subver;
196 char hostname[MPI_MAX_PROCESSOR_NAME];
197 char mpilibver[MPI_MAX_LIBRARY_VERSION_STRING];
199 MPI_Comm_size(MPI_COMM_WORLD, &proc);
200 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
201 MPI_Get_version(&mpi_ver, &mpi_subver);
202 MPI_Get_library_version(mpilibver,&len);
204 while ((p = strchr(mpilibver,
'\n')) !=
NULL) *p =
'\0';
205 MPI_Get_processor_name(hostname, &len);
211 printf(
"execute: \n");
214 d=(int)difftime(t,mktime(gmtime(&t)));
215 strftime(date,
sizeof(date),
"%Y-%m-%dT%H:%M:%S", localtime(&t));
216 printf(
" date: %s", date);
217 if (abs(d)<86400) printf(
"%+05d", (
int)(d/3600)*100+(
int)(d/60)%60);
223 printf(
" MPI: \"%d.%d, %.128s\"\n", mpi_ver, mpi_subver, mpilibver);
230 printf(
" %d: %s\n",0,hostname);
231 for (i=1;i<proc;i++){
232 MPI_Recv(&hostname,
sizeof(hostname), MPI_CHAR, i, 0, MPI_COMM_WORLD, &status);
233 printf(
" %d: %s\n",i,hostname);
236 MPI_Send(&hostname, len, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
239 gethostname(hostname,
sizeof(hostname));
240 printf(
" %d: %s\n",0,hostname);
242 if (rank==0) printf(
"---\n");
251 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
254 if (rank==0) printf(
"---\n");
262 fprintf(stderr,
"Sorry this option cannot work yet. (-c)\n");
263 fprintf(stderr,
"%s\n", arg);
284 {
"-t", set_num_threads},
285 {
"-T", set_num_threads},
296 int main(
int argc,
char *argv[])
302 MPI_Init(&argc, &argv);
304 for (i = 0; i < argc; i++) {
307 p->
func(argv[i + 1]);
314 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