@@ -217,11 +217,17 @@ AC_SUBST(USE_LIBCUTILS_A)
217
217
218
218
# MPI defaults (may be overridden on special systems)
219
219
USE_MACHINE=normal
220
+
220
221
# The "launcher" is used by job submission systems to launch jobs
221
222
# Usually a path to mpiexec
222
223
# Note: schedulers are handled by turbine/scripts/submit/*
223
224
USE_LAUNCHER=0
225
+
226
+ # This is set my --with-mpi
227
+ # Normally this is the prefix of an MPI build,
228
+ # or /usr in an APT or Yum installation
224
229
USE_MPI_DIR=0
230
+
225
231
USE_MPI_INCLUDE=0
226
232
USE_MPI_LIB_DIR=0
227
233
USE_MPI_LIB_NAME=
@@ -256,10 +262,6 @@ AC_ARG_WITH(mpi,
256
262
fi
257
263
fi
258
264
USE_MPI_DIR=${withval}
259
- if [ [ -d ${USE_MPI_DIR}/include ] ]
260
- then
261
- USE_MPI_INCLUDE=${USE_MPI_DIR}/include
262
- fi
263
265
MPI_LABEL_DIR="${USE_MPI_DIR}"
264
266
AC_MSG_RESULT ( [ Trying MPI directory: ${USE_MPI_DIR}] )
265
267
] ,
@@ -298,89 +300,20 @@ AC_ARG_ENABLE(mpi-checks,
298
300
if [ [ ${USE_MPI_DIR} == 0 ] ] && [ [ ${ENABLE_CUSTOM_MPI} == 0 ] ]
299
301
then
300
302
program=$( which mpicc 2> /dev/null)
301
- if [ [ ${?} == 0 ] ]
303
+ if (( ${?} == 0 ))
302
304
then
303
305
AC_MSG_RESULT ( [ PATH contains: ${program}] )
304
- TRY_MPI_DIR=$( cd $(dirname ${program})/.. ; /bin/pwd )
305
- if [ [ -f ${TRY_MPI_DIR}/include/mpich/mpi.h ] ]
306
- then
307
- USE_MPI_DIR=${TRY_MPI_DIR}
308
- USE_MPI_INCLUDE=${USE_MPI_DIR}/include/mpich
309
- elif [ [ -f ${TRY_MPI_DIR}/include/mpi.h ] ]
310
- then
311
- USE_MPI_DIR=${TRY_MPI_DIR}
312
- USE_MPI_INCLUDE=${USE_MPI_DIR}/include
313
- elif [ [ -f ${TRY_MPI_DIR}/lib/x86_64-linux-gnu/mpich/include/mpi.h ] ]
314
- then
315
- USE_MPI_DIR=${TRY_MPI_DIR}
316
- USE_MPI_INCLUDE=${USE_MPI_DIR}/lib/x86_64-linux-gnu/mpich/include
317
- fi
318
- AC_MSG_RESULT ( [ Trying MPI directory: ${USE_MPI_DIR}] )
319
- elif (( ! ENABLE_CUSTOM_MPI && ENABLE_MPI_CHECKS ))
320
- then
321
- AC_MSG_ERROR ( [ Turbine requires --with-mpi or
322
- --enable-custom-mpi or
323
- or mpicc in PATH .] )
324
- fi
306
+ USE_MPI_DIR=$( cd $(dirname ${program})/.. ; /bin/pwd )
307
+ AC_MSG_RESULT ( [ Setting MPI_DIR to ${USE_MPI_DIR} ...] )
325
308
MPI_LABEL_DIR="${USE_MPI_DIR}"
326
309
fi
327
310
328
- # Set MPI_DIR with respect to a system MPICH (NEWER c. 2021)
329
- if [ [ ${USE_MPI_DIR} == 0 ] ] && [ [ ${ENABLE_CUSTOM_MPI} == 0 ] ]
311
+ # At this point, USE_MPI_DIR must be set!
312
+ if (( ! ENABLE_CUSTOM_MPI && ENABLE_MPI_CHECKS ))
330
313
then
331
- if [ [ -r /usr/lib/x86_64-linux-gnu/mpich/include/mpi.h ] ]
332
- then
333
- # APT
334
- DIR=/usr/lib/x86_64-linux-gnu/mpich
335
- AC_MSG_RESULT ( [ Using MPICH (APT) directory: ${DIR}] )
336
- USE_MPI_DIR=${DIR}
337
- if [ [ ${USE_LAUNCHER} == 0 ] ]
338
- then
339
- USE_LAUNCHER=/usr/bin/mpiexec
340
- fi
341
- USE_MPI_INCLUDE=${USE_MPI_DIR}/include
342
- USE_MPI_LIB=/usr/lib/x86_64-linux-gnu
343
- elif [ [ -r /usr/include/mpich-x86_64/mpi.h ] ]
344
- then
345
- # Yum MPICH
346
- DIR=/usr/lib64/mpich
347
- AC_MSG_RESULT ( [ Using MPICH (Yum) directory: ${DIR}] )
348
- USE_MPI_DIR=${DIR}
349
- if [ [ ${USE_LAUNCHER} == 0 ] ]
350
- then
351
- USE_LAUNCHER=/usr/lib64/mpich/bin/mpiexec
352
- fi
353
- USE_MPI_INCLUDE=/usr/include/mpich-x86_64
354
- USE_MPI_LIB=${USE_MPI_DIR}/lib
355
- fi
356
- fi
357
-
358
- # Try to set MPI_DIR with respect to a system OpenMPI
359
- if [ [ ${USE_MPI_DIR} == 0 ] ] && [ [ ${ENABLE_CUSTOM_MPI} == 0 ] ]
360
- then
361
- if [ [ -r /usr/lib/x86_64-linux-gnu/openmpi/include/mpi.h ] ]
362
- then
363
- AC_MSG_RESULT ( [ Using OpenMPI (Debian) directory: ${OPENMPI}] )
364
- USE_MPI_DIR=/usr/lib/x86_64-linux-gnu/openmpi
365
- if [ [ $USE_LAUNCHER == 0 ] ]
366
- then
367
- USE_LAUNCHER=/usr/bin/mpiexec
368
- fi
369
- USE_MPI_INCLUDE=${USE_MPI_DIR}/include
370
- USE_MPI_LIB=${USE_MPI_DIR}/lib
371
- elif [ [ -r /usr/include/openmpi-x86_64/mpi.h ] ]
372
- then
373
- # Yum OpenMPI
374
- DIR=/usr/lib64/openmpi
375
- AC_MSG_RESULT ( [ Using OpenMPI (Yum) directory: ${DIR}] )
376
- USE_MPI_DIR=${DIR}
377
- if [ [ ${USE_LAUNCHER} == 0 ] ]
378
- then
379
- USE_LAUNCHER=/usr/lib64/openmpi/bin/mpiexec
380
- fi
381
- USE_MPI_INCLUDE=/usr/include/openmpi-x86_64
382
- USE_MPI_LIB=${USE_MPI_DIR}/lib
383
- fi
314
+ AC_MSG_ERROR ( [ Turbine requires --with-mpi or
315
+ --enable-custom-mpi or
316
+ or mpicc in PATH .] )
384
317
fi
385
318
386
319
if [ [ ${USE_LAUNCHER} == 0 ] ]
@@ -397,26 +330,19 @@ if [[ ${USE_LAUNCHER} == 0 ]]
397
330
then
398
331
# Try to set launcher based on PATH
399
332
program=$( which mpiexec 2> /dev/null )
400
- if [ [ ${?} == 0 ] ]
333
+ if (( ${?} == 0 ))
401
334
then
402
335
AC_MSG_RESULT ( [ Found ${program} in PATH.] )
403
336
USE_LAUNCHER=${program}
404
- else
405
- AC_MSG_WARN ( [ mpiexec not found: no default Turbine launcher] )
406
337
fi
407
338
fi
408
339
409
- AC_MSG_RESULT ( [ Using MPI launcher: ${USE_LAUNCHER}] )
410
-
411
- # Look for mpi.h at its APT location
412
- if [ [ ! -f ${USE_MPI_INCLUDE}/mpi.h ] ]
340
+ # At this point, USE_LAUNCHER must be set!
341
+ if [ [ ${USE_LAUNCHER} == 0 ] ] && [ [ ${ENABLE_CUSTOM_MPI} == 0 ] ]
413
342
then
414
- if [ [ -f ${USE_MPI_INCLUDE}/mpi/mpi.h ] ]
415
- then
416
- # Obsolete location? 2020-01-04
417
- USE_MPI_INCLUDE=${USE_MPI_INCLUDE}/mpi
418
- fi
343
+ AC_MSG_WARN ( [ No MPI launcher (e.g., mpiexec) was found!] )
419
344
fi
345
+ AC_MSG_RESULT ( [ Using MPI launcher: ${USE_LAUNCHER}] )
420
346
421
347
AC_ARG_WITH ( mpi-include ,
422
348
AS_HELP_STRING ( [ --with-mpi-include] ,
@@ -426,6 +352,27 @@ AC_ARG_WITH(mpi-include,
426
352
] ,
427
353
[ ] )
428
354
355
+ MPI_INCLUDE_TRIES=(
356
+ # Normal location for source build:
357
+ ${USE_MPI_DIR}/include
358
+ # MPICH via APT:
359
+ ${USE_MPI_DIR}/lib/x86_64-linux-gnu/mpich/include
360
+ # MPICH via Yum:
361
+ ${USE_MPI_DIR}/include/mpich-x86_64
362
+ # OpenMPI via APT:
363
+ ${USE_MPI_DIR}/lib/x86_64-linux-gnu/openmpi/include
364
+ # OpenMPI via Yum:
365
+ ${USE_MPI_DIR}/include/openmpi-x86_64
366
+ )
367
+ for TRY in ${MPI_INCLUDE_TRIES[ @] }
368
+ do
369
+ if [ [ ${USE_MPI_INCLUDE} != 0 ] ]
370
+ then
371
+ break
372
+ fi
373
+ AC_CHECK_FILE ( $TRY/mpi.h , [ USE_MPI_INCLUDE=$TRY] )
374
+ fi
375
+
429
376
AC_ARG_WITH ( mpi-lib-dir ,
430
377
AS_HELP_STRING ( [ --with-mpi-lib-dir] ,
431
378
[ directory containing MPI lib (usually libmpich)] ) ,
@@ -459,13 +406,15 @@ AC_ARG_WITH(mpi-lib-extra,
459
406
] ,
460
407
[ ] )
461
408
409
+
410
+
462
411
# Now check MPI settings
463
412
464
413
if (( ENABLE_MPI_CHECKS ))
465
414
then
466
415
467
416
AC_CHECK_FILE ( ${USE_MPI_INCLUDE}/mpi.h ,
468
- [ ] ,
417
+ [ AC_MSG_RESULT ( [ Found ${USE_MPI_INCLUDE}/mpi.h ] ) ] ,
469
418
[ AC_MSG_ERROR ( [ Could not find mpi.h in ${USE_MPI_INCLUDE}] ) ] )
470
419
471
420
MPI_LIB_FOUND=0
0 commit comments