Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:39:18

0001 #!/usr/bin/env python
0002 # Licensed under the Apache License, Version 2.0 (the "License");
0003 # you may not use this file except in compliance with the License.
0004 # You may obtain a copy of the License at
0005 # http://www.apache.org/licenses/LICENSE-2.0
0006 #
0007 # Authors:
0008 # - Danila Oleynik, danila.oleynik@cern.ch, 2018
0009 # - Paul Nilsson, paul.nilsson@cern.ch, 2019
0010 
0011 # Note: The Pilot 2 utilities to provide MPI related functionality through mpi4py
0012 # Required for HPC workflow where Pilot 2 acts like an MPI application
0013 
0014 # remove logging for now since it has a tendency to dump error messages like this in stderr:
0015 # 'No handlers could be found for logger "pilot.util.mpi"'
0016 # import logging
0017 # try:
0018 #     logger = logging.getLogger(__name__)
0019 # except Exception:
0020 #     logger = None
0021 
0022 
0023 def get_ranks_info():
0024     """
0025     Return current MPI rank and number of ranks
0026     None, None - if MPI environment is not available
0027 
0028     :return: rank, max_rank
0029     """
0030 
0031     rank = None
0032     max_rank = None
0033     try:
0034         pass  # removed in April 2020 since it was only used on Titan and is causing import errors
0035         #from mpi4py import MPI
0036         #comm = MPI.COMM_WORLD
0037         #rank = comm.Get_rank()
0038         #max_rank = comm.Get_size()
0039     except ImportError:
0040         print("mpi4py not found")
0041 #        if logger:
0042 #            logger.info("mpi4py not found")
0043 #        else:
0044 #            print("mpi4py not found")
0045     return rank, max_rank