14#if defined(QDP_USE_QMT_THREADS)
18#if defined(QDP_USE_OMP_THREADS)
55 bool help_flag =
false;
56 for (
int i=0; i<*argc; i++)
58 if (strcmp((*argv)[i],
"-h")==0)
62 bool setGeomP =
false;
66 bool setIOGeomP =
false;
74 const int maxlen = 256;
76 strncpy(rtinode,
"your_local_food_store", maxlen);
82 fprintf(stderr,
"Usage: %s options\n",(*argv)[0]);
83 fprintf(stderr,
"options:\n");
84 fprintf(stderr,
" -h help\n");
85 fprintf(stderr,
" -V %%d [%d] verbose mode for QMP\n",
87#if defined(QDP_USE_PROFILING)
88 fprintf(stderr,
" -p %%d [%d] profile level\n",
93 fprintf(stderr,
" -geom %%d");
94 for(
int i=1; i <
Nd; i++)
95 fprintf(stderr,
" %%d");
97 fprintf(stderr,
" [-1");
98 for(
int i=1; i <
Nd; i++)
99 fprintf(stderr,
",-1");
100 fprintf(stderr,
"] logical machine geometry\n");
103 fprintf(stderr,
" -cd %%s [.] set working dir for QIO interface\n");
104 fprintf(stderr,
" -rti %%d [%d] use run-time interface\n",
106 fprintf(stderr,
" -rtinode %%s [%s] run-time interface fileserver node\n",
110 fprintf(stderr,
" -poolsize <X> Create a fixed pool of X GB for Pool Alloc\n");
111 fprintf(stderr,
" -bind c:s Bind Threads -- BlueGene Q only, c cores per node and s SMT threads to run per core \n");
118 for (
int i=1; i<*argc; i++)
120 if (strcmp((*argv)[i],
"-V")==0)
124#if defined(QDP_USE_PROFILING)
125 else if (strcmp((*argv)[i],
"-p")==0)
128 sscanf((*argv)[++i],
"%d", &lev);
132 else if ( strcmp((*argv)[i],
"-poolsize")==0)
137 else if (strcmp((*argv)[i],
"-geom")==0)
140 for(
int j=0; j <
Nd; j++)
143 sscanf((*argv)[++i],
"%d", &uu);
144 logical_geom[j] = uu;
147 else if (strcmp((*argv)[i],
"-iogeom")==0)
150 for(
int j=0; j <
Nd; j++)
153 sscanf((*argv)[++i],
"%d", &uu);
154 logical_iogeom[j] = uu;
157 else if (strcmp((*argv)[i],
"-bind")==0)
163 else if (strcmp((*argv)[i],
"-cd")==0)
166 setenv(
"QHOSTDIR", (*argv)[++i], 0);
168 else if (strcmp((*argv)[i],
"-rti")==0)
170 sscanf((*argv)[++i],
"%d", &rtiP);
172 else if (strcmp((*argv)[i],
"-rtinode")==0)
174 int n = strlen((*argv)[++i]);
177 QDPIO::cerr << __func__ <<
": rtinode name too long" << std::endl;
180 sscanf((*argv)[i],
"%s", rtinode);
186 QDPIO::cerr << __func__ <<
": Unknown argument = " << (*argv)[i] << std::endl;
193 QDPIO::cerr << __func__ <<
": missing argument at the end" << std::endl;
203 for (
int i=0; i<*argc; i++)
204 QDP_info(
"QDP_init: arg[%d] = XX%sXX",i,(*argv)[i]);
213 if (QMP_is_initialized() == QMP_FALSE)
215 QMP_thread_level_t prv;
216 if (QMP_init_msg_passing(argc, argv, QMP_THREAD_MULTIPLE, &prv) != QMP_SUCCESS)
218 QDPIO::cerr << __func__ <<
": QMP_init_msg_passing failed" << std::endl;
228 if (QMP_declare_logical_topology(logical_geom.
slice(),
Nd) != QMP_SUCCESS)
230 QDPIO::cerr << __func__ <<
": QMP_declare_logical_topology failed" << std::endl;
250 std::ostringstream outbuf;
251 for(
int mu=0; mu <
Nd; mu++) {
252 outbuf <<
" " << logical_iogeom[mu];
255 QDP_info(
"Setting IO Geometry: %s\n", outbuf.str().c_str());
264#ifdef QDP_USE_QMT_THREADS
268 std::cout <<
"QDP use qmt threading: Initializing threads..." ;
270 int thread_status = qmt_init();
272 if( thread_status == 0 ) {
274 std::cout <<
"Success. We have " <<
qdpNumThreads() <<
" threads \n";
278 std::cout <<
"Failure... qmt_init() returned " << thread_status << std::endl;
283#ifdef QDP_USE_OMP_THREADS
286 std::cout <<
"QDP use OpenMP threading. We have " <<
qdpNumThreads() <<
" threads\n";
296 std::cout <<
"Failure... space for norm2 results failed " << std::endl;
302 std::cout <<
"Failure... space for innerProd results failed " << std::endl;
312#ifdef QDP_USE_OMP_THREADS
336#if defined(QDP_USE_HDF5)
345#if defined(QMT_USE_QMT_THREADS)
347 std::cout <<
"QDP use qmt threading: Finalizing threads" << std::endl;
353 QMP_finalize_msg_passing();
Container for a multi-dimensional 1D array.
const T * slice() const
Return ref to a column slice.
void setIONodeGrid(const multi1d< int > &io_grid)
Set the I/O Node grid – satisfy interface.
void init()
Initializer for layout.
bool primaryNode()
Returns whether this is the primary node.
StandardOutputStream cout
StandardOutputStream cerr
REAL64 * innerProd_results
Yet another random number generator.
void setThreadAffinity(int nCores, int threadsPerCore)
bool QDP_isInitialized()
Is the machine initialized?
void QDP_initialize(int *argc, char ***argv)
Turn on the machine.
static bool isInit
Private flag for status.
void QDP_suspend()
Suspends QDP communications.
int setProgramProfileLevel(int n)
static int n_threads_per_core
void QDP_abort(int status)
Panic button.
void QDP_resume()
Resumes QDP communications.
void initProfile(const std::string &file, const std::string &caller, int line)
void QDP_finalize()
Turn off the machine.
int QDP_info(const char *format,...)
Simple information display routine.
Primary include file for QDP.
void QMP_verbose(QMP_bool_t verbose)