diff --git a/ChangeLog b/ChangeLog index f707c76d7e5f6e2ce4be197e4df5f9c1b76de183..9617a4ed23a2f6ae36d31b2e1d0ede3c018d3309 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-09-26 Enol Fernández <enolfc _AT_ ifca.unican.es> - 1.5.2 + * Development migrated to github + * Fixes for issues #1, #2, #6, #8 & #9 + 2012-11-08 Enol Fernández <enolfc _AT_ ifca.unican.es> - 1.5.0 * New copy_from_node method (#5) diff --git a/modules/hooks/file-dist/mpiexec.filedist b/modules/hooks/file-dist/mpiexec.filedist index fca3c1f625cda6f1a79da5329d3e84f83290a9d5..6992eaf737bb81891508b0324f44391923786743 100644 --- a/modules/hooks/file-dist/mpiexec.filedist +++ b/modules/hooks/file-dist/mpiexec.filedist @@ -10,12 +10,8 @@ check_distribution_method() { result=255 if test "x$I2G_MPI_TYPE" = "xmpich" -o "x$I2G_MPI_TYPE" = "xmpich2"; then if test "x${MPI_START_SCHEDULER}" = "xpbs" ; then - if test "x${MPI_MPIEXEC}" != "x" ; then - $MPI_MPIEXEC 2>&1 | grep -e "-\<np\>" > /dev/null 2>&1 - status=$? - if test $status -ne 0 ; then - result=0 - fi + if test ${OSC_MPIEXEC} -eq 1 ; then + result=0 fi fi fi diff --git a/modules/mpi/mpich2/mpich2.mpi b/modules/mpi/mpich2/mpich2.mpi index f105ddbe4d3513cf3842a24c0705c44691af14b7..66d4ca75b7c171a94fa7f305c3e3cd67d78d8f57 100644 --- a/modules/mpi/mpich2/mpich2.mpi +++ b/modules/mpi/mpich2/mpich2.mpi @@ -22,12 +22,18 @@ mpi_start_get_plugin "osc_mpiexec.sh" 1 # further determine if the mpiexec is hydra if test $OSC_MPIEXEC -eq 0 ; then if test "x$MPI_MPIEXEC" != "x"; then - # try with mpiexec.hydra + # No mpiexec? try finding mpiexec.hydra MPIEXEC=`which mpiexec.hydra 2> /dev/null` if test $? -eq 0 -a "x$MPI_MPICH2_DISABLE_HYDRA" != "x1" ; then export HYDRA_MPIEXEC=1 MPI_MPIEXEC=$MPIEXEC fi + else + # check if defined mpiexec is hydra + $MPI_MPIEXEC -version 2>&1 | grep -i "hydra" > /dev/null 2>&1 + if test $? -eq 0 ; then + export HYDRA_MPIEXEC=1 + fi fi fi diff --git a/modules/mpi/osc_mpiexec.sh b/modules/mpi/osc_mpiexec.sh index 8c3578cfc140e68ffeed88bcac5df5dd6a846542..ccd649a2ade5501ed4ac10039b578e7b64875576 100644 --- a/modules/mpi/osc_mpiexec.sh +++ b/modules/mpi/osc_mpiexec.sh @@ -7,10 +7,19 @@ unset I2G_MPIEXEC_COMM # detect OSC mpiexec if test "x$MPI_MPIEXEC" != "x"; then - $MPI_MPIEXEC 2>&1 | grep -e "-\<np\>" > /dev/null 2>&1 + local VERSION_INFO=`$MPI_MPIEXEC -version 2>&1` st=$? - if test $st -ne 0 ; then - export OSC_MPIEXEC=1 + if test $st -eq 0 ; then + echo $VERSION_INFO | grep -i "hydra" > /dev/null 2>&1 + st=$? + if test $st -ne 0 ; then + # for sure not hydra, check that we do not have -np option + $MPI_MPIEXEC 2>&1 | grep -e "-\<np\>" > /dev/null 2>&1 + st=$? + if test $st -ne 0 ; then + export OSC_MPIEXEC=1 + fi + fi fi fi diff --git a/mpi-start.spec.in b/mpi-start.spec.in index 76cfaf52d967e01a79003f006662d1869592070c..d8544bc8c35b360762e503474553ed56aa41f30e 100644 --- a/mpi-start.spec.in +++ b/mpi-start.spec.in @@ -51,11 +51,13 @@ rm -rf $RPM_BUILD_ROOT %doc docs/AUTHORS docs/COPYING docs/LICENSE README ChangeLog %changelog -* Wed Aug 28 2013 Enol Fernandez <enolfc _AT_ ifca.unican.es> - 1.5.2-%{release} +* Thu Sep 26 2013 Enol Fernandez <enolfc _AT_ ifca.unican.es> - 1.5.2-%{release} - Migrated to github. - Fix issue #1 (OSC mpiexec with mpich configuration) - Fix issue #2 (ssh copy fails if hostname command returns hostname with domain) - Fix issue #6 (Default mpi configuration should be detected by the runtime) +- Fix issue #9 (mpiexec copy method activated when using hydra) +- New feature #8 (Support host list scheduler) * Wed Oct 31 2012 Enol Fernandez <enolfc _AT_ ifca.unican.es> - 1.5.1-1%{?dist} - Improved packaging. diff --git a/src/mpi-start.in b/src/mpi-start.in index 3212d72f886c23192ff808be8f878cc2a5c2ae8e..15f7ba6c3ba1a431a26197bb8fd63cd1cccf851f 100755 --- a/src/mpi-start.in +++ b/src/mpi-start.in @@ -392,21 +392,26 @@ mpi_start_dummy_scheduler() { export MPI_START_HOSTFILE=$MPI_START_TEMP_FILE mpi_start_mktemp export MPI_START_HOST_SLOTS_FILE=$MPI_START_TEMP_FILE - local myhost=`hostname` - local slots=1 - if test "x${MPI_DUMMY_SCH_SLOTS}" != "x" ; then - slots=$MPI_DUMMY_SCH_SLOTS + if test "x$MPI_START_DUMMY_SCH_HOSTS" = "x" ; then + MPI_START_DUMMY_SCH_HOSTS=`hostname` fi - local n=$slots - while [ $n -ne 0 ]; do - echo $myhost >> $MPI_START_MACHINEFILE - n=`expr $n - 1` + local nhosts=0 + local slots=0 + MPI_START_DUMMY_SCH_SLOTS=${MPI_START_DUMMY_SCH_SLOTS:-1} + for host in $MPI_START_DUMMY_SCH_HOSTS ; do + local n=$MPI_START_DUMMY_SCH_SLOTS + while [ $n -ne 0 ]; do + echo $host >> $MPI_START_MACHINEFILE + n=`expr $n - 1` + done + echo $host > $MPI_START_HOSTFILE + echo "$host $MPI_START_DUMMY_SCH_SLOTS"> $MPI_START_HOST_SLOTS_FILE + nhosts=`expr $nhosts + 1` + slots=`expr $slots + $MPI_START_DUMMY_SCH_SLOTS` done - echo $myhost > $MPI_START_HOSTFILE - echo "$myhost $slots"> $MPI_START_HOST_SLOTS_FILE export MPI_START_NSLOTS=$slots - export MPI_START_NHOSTS=1 - export MPI_START_NSLOTS_PER_HOST=$slots + export MPI_START_NHOSTS=$nhosts + export MPI_START_NSLOTS_PER_HOST=$MPI_START_DUMMY_SCH_SLOTS SCHEDULER_NAME="mpi-start-dummy" export MPI_START_SCHEDULER=$SCHEDULER_NAME } @@ -492,8 +497,12 @@ mpi_start_detect_os() { export MPI_START_OS_DIST_TYPE="el" fi export MPI_START_OS_RELEASE=`lsb_release -sr 2> /dev/null` - export MPI_START_OS_RELEASE_MAJOR=`echo $MPI_START_OS_RELEASE | cut -f1 -d"."` + export MPI_START_OS_RELEASE_MAJOR=`echo "$MPI_START_OS_RELEASE" | cut -f1 -d"."` fi + elif test "x${MPI_START_UNAME}" = "xdarwin" ; then + export MPI_START_OS_DIST_TYPE=`uname -s` + export MPI_START_OS_RELEASE=`uname -r` + export MPI_START_OS_RELEASE_MAJOR=`echo "$MPI_START_OS_RELEASE" | cut -f1 -d"."` fi } diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 4439263650535accbee49e6f0904cc17c9307d80..e4f33f6726f67218655ba83e5eb142fffbbccf40 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -94,8 +94,8 @@ if test "x${RUN_UNIT_TESTS}" = "x1" ; then ./test_unit.sh || exitcode=1 echo "* RFC #63" ./test_trac_63.sh || exitcode=1 - echo "* Issue #1" - ./test_issue_1.sh || exitcode=1 + echo "* Issue #1, #9" + ./test_issue_1_and_9.sh || exitcode=1 echo "* Issue #6" ./test_issue_6.sh || exitcode=1 echo "***************************" @@ -145,6 +145,8 @@ if test "x${RUN_FSDETECT_TESTS}" = "x1" ; then ./test_trac_60.sh || exitcode=1 echo "* RFC #5" ./test_trac_5.sh || exitcode=1 + echo "* Issue #3" + ./test_issue_3.sh || exitcode=1 echo "***************************" fi if test "x${RUN_SCH_TESTS}" = "x1" ; then diff --git a/tests/test_dummy.sh b/tests/test_dummy.sh index 3710b6463f5f0e51ac8c443d55737319728a9f9b..86b5cc3ca74577bb85b00b7c210fa1551c5ede5a 100755 --- a/tests/test_dummy.sh +++ b/tests/test_dummy.sh @@ -14,6 +14,8 @@ setUp () { unset I2G_MPI_SINGLE_PROCESS unset I2G_MPI_NP unset I2G_MPI_PER_NODE + unset MPI_START_DUMMY_SCH_SLOTS + unset MPI_START_DUMMY_SCH_HOSTS export MPI_START_SHARED_FS=1 export MPI_START_DUMMY_SCHEDULER=0 } @@ -55,4 +57,81 @@ testSchedulerError () { unset MPI_START_DUMMY_SCHEDULER } +testDummySchedulerNSlots () { + export MPI_START_DUMMY_SCHEDULER=1 + export I2G_MPI_APPLICATION=`$MYMKTEMP` + export MPI_START_DUMMY_SCH_SLOTS=2 + cat > $I2G_MPI_APPLICATION << EOF +#!/bin/sh +echo "\${MPI_START_NSLOTS};\${MPI_START_NHOSTS};\${MPI_START_NSLOTS_PER_HOST};\${MPI_START_NP};\${MPI_START_SCHEDULER}" +EOF + chmod +x $I2G_MPI_APPLICATION + output=`$I2G_MPI_START -npnode 3` + st=$? + slots=`echo $output | cut -f1 -d";"` + hosts=`echo $output | cut -f2 -d";"` + sperhosts=`echo $output | cut -f3 -d";"` + np=`echo $output | cut -f4 -d";"` + sch=`echo $output | cut -f5 -d";"` + assertEquals "mpi-start-dummy" $sch + assertEquals 2 $slots + assertEquals 1 $hosts + assertEquals 2 $sperhosts + assertEquals 3 $np + assertEquals 0 $st + rm -f $I2G_MPI_APPLICATION +} + + +testDummySchedulerNHosts() { + export MPI_START_DUMMY_SCHEDULER=1 + export I2G_MPI_APPLICATION=`$MYMKTEMP` + export MPI_START_DUMMY_SCH_HOSTS="host1 host2 host3" + cat > $I2G_MPI_APPLICATION << EOF +#!/bin/sh +echo "\${MPI_START_NSLOTS};\${MPI_START_NHOSTS};\${MPI_START_NSLOTS_PER_HOST};\${MPI_START_NP};\${MPI_START_SCHEDULER}" +EOF + chmod +x $I2G_MPI_APPLICATION + output=`$I2G_MPI_START -npnode 3` + st=$? + slots=`echo $output | cut -f1 -d";"` + hosts=`echo $output | cut -f2 -d";"` + sperhosts=`echo $output | cut -f3 -d";"` + np=`echo $output | cut -f4 -d";"` + sch=`echo $output | cut -f5 -d";"` + assertEquals "mpi-start-dummy" $sch + assertEquals 3 $slots + assertEquals 3 $hosts + assertEquals 1 $sperhosts + assertEquals 9 $np + assertEquals 0 $st + rm -f $I2G_MPI_APPLICATION +} + + +testDummySchedulerNHostsNSlots() { + export MPI_START_DUMMY_SCHEDULER=1 + export I2G_MPI_APPLICATION=`$MYMKTEMP` + export MPI_START_DUMMY_SCH_SLOTS=2 + export MPI_START_DUMMY_SCH_HOSTS="host1 host2 host3" + cat > $I2G_MPI_APPLICATION << EOF +#!/bin/sh +echo "\${MPI_START_NSLOTS};\${MPI_START_NHOSTS};\${MPI_START_NSLOTS_PER_HOST};\${MPI_START_NP};\${MPI_START_SCHEDULER}" +EOF + chmod +x $I2G_MPI_APPLICATION + output=`$I2G_MPI_START -npnode 3` + st=$? + slots=`echo $output | cut -f1 -d";"` + hosts=`echo $output | cut -f2 -d";"` + sperhosts=`echo $output | cut -f3 -d";"` + np=`echo $output | cut -f4 -d";"` + sch=`echo $output | cut -f5 -d";"` + assertEquals "mpi-start-dummy" $sch + assertEquals 6 $slots + assertEquals 3 $hosts + assertEquals 2 $sperhosts + assertEquals 9 $np + assertEquals 0 $st + rm -f $I2G_MPI_APPLICATION +} . $SHUNIT2 diff --git a/tests/test_issue_1.sh b/tests/test_issue_1_and_9.sh similarity index 77% rename from tests/test_issue_1.sh rename to tests/test_issue_1_and_9.sh index 80cf4bdf25aba861a141b7f7b6efbba5de8b245e..c2ee0e1704f46ae6920ee1af9afb9d9b0c2334d9 100755 --- a/tests/test_issue_1.sh +++ b/tests/test_issue_1_and_9.sh @@ -23,6 +23,10 @@ fake_mpiexec() { echo "fake mpiexec -np option" 1>&2 } +fake_hydra_mpiexec() { + echo "fake hydra mpiexec, fake no options" 1>&2 +} + testValidOSCmpiexec() { export MPI_MPIEXEC=fake_osc_mpiexec mpi_start_get_plugin "osc_mpiexec.sh" 1 @@ -37,6 +41,12 @@ testInvalidOSCmpiexec() { assertEquals "0" "$OSC_MPIEXEC" } -# XXX missing tests for OSC mpiexec with the implementations +testHydrampiexec() { + export MPI_MPIEXEC=fake_hydra_mpiexec + mpi_start_get_plugin "osc_mpiexec.sh" 1 + . $MPI_START_PLUGIN_FILES + assertEquals "0" "$OSC_MPIEXEC" +} + . $SHUNIT2 diff --git a/tests/test_issue_3.sh b/tests/test_issue_3.sh new file mode 100755 index 0000000000000000000000000000000000000000..b09e58718e52454bdeb44b14bb417dc6d0a85b80 --- /dev/null +++ b/tests/test_issue_3.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# Test for https://github.com/IFCA/mpi-start/issues/1 + +oneTimeSetUp () { + export I2G_MPI_START_ENABLE_TESTING="TEST" + # source the mpi-start code to have all functions + . $I2G_MPI_START + mpi_start_check_options +} + +oneTimeTearDown () { + for f in $MPI_START_CLEANUP_FILES; do + [ -f "$f" ] && rm -f $f + [ -d "$f" ] && rm -rf $f + done +} + + +testHostLocalhost() { + mpi_start_get_plugin "ssh.filedist" 1 + . $MPI_START_PLUGIN_FILES + is_localhost "localhost" + assertEquals "0" "$?" +} + +testHostHostname() { + mpi_start_get_plugin "ssh.filedist" 1 + . $MPI_START_PLUGIN_FILES + is_localhost `hostname` + assertEquals "0" "$?" +} + +testHostHostnameS() { + mpi_start_get_plugin "ssh.filedist" 1 + . $MPI_START_PLUGIN_FILES + is_localhost `hostname -s` + assertEquals "0" "$?" +} + +testHostHostnameF() { + mpi_start_get_plugin "ssh.filedist" 1 + . $MPI_START_PLUGIN_FILES + is_localhost `hostname -f` + assertEquals "0" "$?" +} + +. $SHUNIT2 diff --git a/tests/test_issue_6.sh b/tests/test_issue_6.sh index 1dfb075e665890d7efb60906625694a8c50138db..e63ec09435164d523920bc6c62ec1c92e5ee8623 100755 --- a/tests/test_issue_6.sh +++ b/tests/test_issue_6.sh @@ -12,6 +12,7 @@ oneTimeSetUp () { setUp() { export MPI_START_ETC_LIST=`$MYMKTEMP -d` export MPI_LOADED=0 + export MPI_LOADED_2=0 } tearDown() { @@ -28,36 +29,46 @@ oneTimeTearDown () { testConfigDistReleaseArch() { echo "export MPI_LOADED=1" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_OS_DIST_TYPE}${MPI_START_OS_RELEASE_MAJOR}-${MPI_START_ARCH} assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" } testConfigDistRelease() { echo "export MPI_LOADED=1" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_OS_DIST_TYPE}${MPI_START_OS_RELEASE_MAJOR} assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" } testConfigDist() { echo "export MPI_LOADED=1" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_OS_DIST_TYPE} assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" } testConfigUname() { echo "export MPI_LOADED=1" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_UNAME} assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" } testConfigLocal() { echo "export MPI_LOADED=1" > $MPI_START_ETC_LIST/mpi-config.local assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" } testConfigOrderDistReleaseArch() { @@ -67,6 +78,7 @@ testConfigOrderDistReleaseArch() { echo "export MPI_LOADED_2=3" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_OS_DIST_TYPE} echo "export MPI_LOADED_2=4" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_UNAME} assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" assertEquals "1" "$MPI_LOADED_2" @@ -78,6 +90,7 @@ testConfigOrderDistRelease() { echo "export MPI_LOADED_2=3" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_OS_DIST_TYPE} echo "export MPI_LOADED_2=4" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_UNAME} assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" assertEquals "2" "$MPI_LOADED_2" @@ -85,9 +98,11 @@ testConfigOrderDistRelease() { testConfigOrderDist() { echo "export MPI_LOADED=1" > $MPI_START_ETC_LIST/mpi-config.local - echo "export MPI_LOADED_2=3" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_OS_DIST_TYPE} + # darwin is not case sensitive for file names!!!! echo "export MPI_LOADED_2=4" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_UNAME} + echo "export MPI_LOADED_2=3" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_OS_DIST_TYPE} assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" assertEquals "3" "$MPI_LOADED_2" @@ -97,6 +112,7 @@ testConfigOrderUname() { echo "export MPI_LOADED=1" > $MPI_START_ETC_LIST/mpi-config.local echo "export MPI_LOADED_2=4" > $MPI_START_ETC_LIST/mpi-config.${MPI_START_UNAME} assertEquals "0" "$MPI_LOADED" + assertEquals "0" "$MPI_LOADED_2" mpi_start_load_mpi_config assertEquals "1" "$MPI_LOADED" assertEquals "4" "$MPI_LOADED_2" diff --git a/tests/test_omp.sh b/tests/test_omp.sh index 2d34d593d7c429c8a48f6b95f83eea3e360c9d5e..eb22a18e027b3ab7b46ee4e1b991015f044acc95 100755 --- a/tests/test_omp.sh +++ b/tests/test_omp.sh @@ -65,7 +65,7 @@ setUp () { testPreCompiledOMP () { # force the number of threads? - OUTPUT=`$I2G_MPI_START -d MPI_USE_OMP=1 -t dummy -d MPI_DUMMY_SCH_SLOTS=2 -e /dev/null $OMP_BIN` + OUTPUT=`$I2G_MPI_START -d MPI_USE_OMP=1 -t dummy -d MPI_START_DUMMY_SCH_SLOTS=2 -e /dev/null $OMP_BIN` st=$? assertEquals 0 $st assertEquals "Number of threads = 2" "$OUTPUT" @@ -84,7 +84,7 @@ post_run_hook () { } EOF # force the number of threads? - OUTPUT=`$I2G_MPI_START -d MPI_USE_OMP=1 -t dummy -d MPI_DUMMY_SCH_SLOTS=2 \ + OUTPUT=`$I2G_MPI_START -d MPI_USE_OMP=1 -t dummy -d MPI_START_DUMMY_SCH_SLOTS=2 \ -pre $myhook -post $myhook -e /dev/null` st=$? assertEquals 0 $st