Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions python/solid_dmft/dft_managers/mpi_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def create_hostfile(number_cores, cluster_name):
return None

hostnames = mpi.world.gather(socket.gethostname(), root=0)
if cluster_name == 'slurm':
slurm_hostnames = [hostname.split('.')[0] for hostname in hostnames] # TODO: please find a better solution
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you enlighten me why this extra part is necessary in this case?

hostnames = slurm_hostnames
if mpi.is_master_node():
# create hostfile based on first number_cores ranks
hosts = defaultdict(int)
Expand All @@ -68,6 +71,7 @@ def create_hostfile(number_cores, cluster_name):
mask_hostfile = {'openmpi': '{} slots={}', # OpenMPI format
'openmpi-intra': '{} slots={}', # OpenMPI format
'mpich': '{}:{}', # MPICH format
'slurm': '{}', # SLURM format
}[cluster_name]

hostfile = 'dft.hostfile'
Expand Down Expand Up @@ -148,6 +152,14 @@ def get_mpi_arguments(mpi_profile, mpi_exe, number_cores, dft_exe, hostfile):
return [mpi_exe, '-launcher', 'ssh', '-hostfile', hostfile,
'-np', str(number_cores), '-envlist', 'PATH'] + shlex.split(dft_exe)

if mpi_profile == 'slurm':
return [
mpi_exe, '-n', str(number_cores), '--export=PATH',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we enforce here that mpi_exe is 'srun' ?

'-N', os.getenv("SLURM_JOB_NUM_NODES"), '-A', os.getenv("SLURM_JOB_ACCOUNT"),
'-p', os.getenv("SLURM_JOB_PARTITION"), '-t', '05:00', #TODO: decide way to get time limit
'-w', f"./{hostfile}",
] + shlex.split(dft_exe)

return None


Expand Down
2 changes: 1 addition & 1 deletion python/solid_dmft/io_tools/verify_input_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _verify_input_params_dft(params: FullConfig) -> None:
if params['dft']['dft_code'] not in ('vasp', 'qe', None):
raise ValueError(f'Invalid "dft.dft_code" = {params["dft"]["dft_code"]}.')

if params['dft']['mpi_env'] not in ('default', 'openmpi', 'openmpi-intra', 'mpich'):
if params['dft']['mpi_env'] not in ('default', 'openmpi', 'openmpi-intra', 'mpich', 'slurm'):
raise ValueError(f'Invalid "dft.mpi_env" = {params["dft"]["mpi_env"]}.')

if params['dft']['projector_type'] not in ('w90', 'plo'):
Expand Down