Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 344d6987 authored by Edward Andò's avatar Edward Andò
Browse files

drop mpi4py as necessary dependency, hide import behind a try statement for ldic and ddic

parent 6a8a4837
Pipeline #49755 passed with stages
in 23 minutes and 34 seconds
......@@ -3,7 +3,8 @@ scipy==1.4.1
SimpleITK==1.2.4
mpi4py==3.0.3
# This is now fully optional, removing from build system
# mpi4py==3.0.3
pybind11==2.5.0
progressbar==2.5
......
......@@ -53,34 +53,41 @@ parser = argparse.ArgumentParser(description="spam-ddic "+spam.helpers.optionsPa
args = spam.helpers.optionsParser.ddicParser(parser)
if args.MPI:
import mpi4py.MPI
try:
import mpi4py.MPI
mpiComm = mpi4py.MPI.COMM_WORLD
mpiSize = mpiComm.Get_size()
mpiRank = mpiComm.Get_rank()
mpiStatus = mpi4py.MPI.Status()
numberOfWorkers = mpiSize - 1
mpiComm = mpi4py.MPI.COMM_WORLD
mpiSize = mpiComm.Get_size()
mpiRank = mpiComm.Get_rank()
mpiStatus = mpi4py.MPI.Status()
numberOfWorkers = mpiSize - 1
boss = mpiSize - 1
boss = mpiSize - 1
if mpiSize < 2:
mpi = False
if mpiRank == boss:
print("spam-ddic: I was launched with {} processes, need at least 2 for MPI, using single thread mode".format(mpiSize))
numberOfWorkers = 1
workersActive = numpy.array([0])
else:
mpi = True
if mpiRank == boss:
print("spam-ddic: I was launched with {} processes, using MPI parallelisation".format(mpiSize))
if mpiSize < 2:
numberOfWorkers = mpiSize - 1
workersActive = numpy.zeros(numberOfWorkers)
except:
mpi = False
if mpiRank == boss:
print("spam-ddic: I was launched with {} processes, need at least 2 for MPI, using single thread mode".format(mpiSize))
mpiRank = None
boss = "Eddy"
numberOfWorkers = 1
workersActive = numpy.array([0])
else:
mpi = True
if mpiRank == boss:
print("spam-ddic: I was launched with {} processes, using MPI parallelisation".format(mpiSize))
numberOfWorkers = mpiSize - 1
workersActive = numpy.zeros(numberOfWorkers)
else:
mpi = False
mpiRank = None
boss = "Eddy"
numberOfWorkers = 1
workersActive = numpy.array([0])
......
......@@ -48,25 +48,30 @@ if len(args.inFiles) < 2:
exit()
if args.MPI:
import mpi4py.MPI
mpiComm = mpi4py.MPI.COMM_WORLD
mpiSize = mpiComm.Get_size()
mpiRank = mpiComm.Get_rank()
mpiStatus = mpi4py.MPI.Status()
numberOfWorkers = mpiSize - 1
boss = mpiSize-1
if mpiSize < 2:
try:
import mpi4py.MPI
mpiComm = mpi4py.MPI.COMM_WORLD
mpiSize = mpiComm.Get_size()
mpiRank = mpiComm.Get_rank()
mpiStatus = mpi4py.MPI.Status()
numberOfWorkers = mpiSize - 1
boss = mpiSize-1
if mpiSize < 2:
mpi = False
if mpiRank == boss:
print("ldic: I was launched with {} processes, need at least 2 for MPI, using single thread mode".format(mpiSize))
# exit()
else:
mpi = True
if mpiRank == boss:
print("ldic: I was launched with {} processes, using MPI parallelisation".format(mpiSize))
except:
mpi = False
if mpiRank == boss:
print("ldic: I was launched with {} processes, need at least 2 for MPI, using single thread mode".format(mpiSize))
# exit()
else:
mpi = True
if mpiRank == boss:
print("ldic: I was launched with {} processes, using MPI parallelisation".format(mpiSize))
mpiRank = None
boss = "Olga"
else:
mpi = False
mpiRank = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment