13 #include <FrontISTRConfig.h>
40 MPI_Comm_size(MPI_COMM_WORLD, &proc);
49 return omp_get_max_threads();
59 void set_num_threads(
char *arg) {
63 fprintf(stderr,
"Error : specify number of OpenMP threads.\n");
64 fprintf(stderr,
"Format: -t <n>\n");
68 exec_threads = atoi(arg);
70 if (exec_threads == 0) {
71 fprintf(stderr,
"Error : specify 1 or more OpenMP threads.\n");
74 omp_set_num_threads(exec_threads);
76 mkl_set_num_threads(exec_threads);
86 printf(
"usage: [ mpirun -np <mpiprocs> ] fistr1 [options] \n");
87 printf(
" -h: Show this help message.\n");
88 printf(
" -v: Show version.\n");
90 printf(
" -t <n>: Set number of OpenMP threads\n");
92 printf(
" -c <Path of control file>: Use this control file. Default "
93 "./hecmw_ctrl.dat\n");
94 printf(
"--debug: Show debug messages.\n");
104 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
107 printf(
"##################################################################\n");
108 printf(
"# FrontISTR #\n");
109 printf(
"##################################################################\n");
111 if (VERSION_PATCH == 0){
112 printf(
"version: %d.%d\n", VERSION_MAJOR, VERSION_MINOR);
114 printf(
"version: %d.%d.%d\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
116 printf(
"git_hash: %s\n", GIT_HASH );
118 printf(
" date: %s\n", BUILD_DATE );
120 printf(
" MPI: \"%d.%d", MPI_VERSION, MPI_SUBVERSION);
121 #if defined(MVAPITCH2_VERSION)
122 printf(
", MVAPITCH %s", MVAPITCH2_VERSION);
123 #elif defined(I_MPI_VERSION)
124 printf(
", Intel MPI %s", I_MPI_VERSION);
125 #elif defined(MSMPI_VER)
126 printf(
", Microsoft MPI");
127 #elif defined(MPI_NEC_MODE_GETPUTALIGNED)
129 #elif defined(MPICH_VERSION)
130 printf(
", MPICH %s", MPICH_VERSION);
131 #elif defined(OMPI_MAJOR_VERSION)
132 printf(
", Open MPI %d.%d.%d", OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, OMPI_RELEASE_VERSION);
136 printf(
" MPI: disabled\n");
139 printf(
" OpenMP: %d\n", _OPENMP);
141 printf(
" OpenMP: disabled\n");
149 printf(
"--with-tools ");
152 printf(
"--with-refiner ");
155 printf(
"--with-metis ");
158 printf(
"--with-mumps ");
161 printf(
"--with-lapack ");
164 printf(
"--with-ml ");
167 printf(
"--with-parmetis ");
170 printf(
"--with-mkl ");
174 #ifdef HECMW_METIS_VER
175 printf(
" HECMW_METIS_VER: %d\n", HECMW_METIS_VER);
184 int proc, i, len, mpi_ver, mpi_subver;
190 char hostname[MPI_MAX_PROCESSOR_NAME];
191 char mpilibver[MPI_MAX_LIBRARY_VERSION_STRING];
193 MPI_Comm_size(MPI_COMM_WORLD, &proc);
194 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
195 MPI_Get_version(&mpi_ver, &mpi_subver);
196 MPI_Get_library_version(mpilibver,&len);
198 while ((p = strchr(mpilibver,
'\n')) !=
NULL) *p =
'\0';
199 MPI_Get_processor_name(hostname, &len);
205 printf(
"execute: \n");
208 d=(int)difftime(t,mktime(gmtime(&t)));
209 strftime(date,
sizeof(date),
"%Y-%m-%dT%H:%M:%S", localtime(&t));
210 printf(
" date: %s", date);
211 if (abs(d)<86400) printf(
"%+05d", (
int)(d/3600)*100+(
int)(d/60)%60);
217 printf(
" MPI: \"%d.%d, %.128s\"\n", mpi_ver, mpi_subver, mpilibver);
224 printf(
" %d: %s\n",0,hostname);
225 for (i=1;i<proc;i++){
226 MPI_Recv(&hostname,
sizeof(hostname), MPI_CHAR, i, 0, MPI_COMM_WORLD, &status);
227 printf(
" %d: %s\n",i,hostname);
230 MPI_Send(&hostname, len, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
233 gethostname(hostname,
sizeof(hostname));
234 printf(
" %d: %s\n",0,hostname);
236 if (rank==0) printf(
"---\n");
245 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
248 if (rank==0) printf(
"---\n");
256 fprintf(stderr,
"Sorry this option cannot work yet. (-c)\n");
257 fprintf(stderr,
"%s\n", arg);
278 {
"-t", set_num_threads},
279 {
"-T", set_num_threads},
290 int main(
int argc,
char *argv[])
296 MPI_Init(&argc, &argv);
298 for (i = 0; i < argc; i++) {
301 p->
func(argv[i + 1]);
308 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