Ejemplo n.º 1
0
def _create_messenger(mpi_config, options):
    global msg

    # use a cached messenger if available
    if msg is not None:
        return msg

    msg = _hoomd.Messenger(mpi_config)

    # try to detect if we're running inside an MPI job
    inside_mpi_job = mpi_config.getNRanksGlobal() > 1
    if ('OMPI_COMM_WORLD_RANK' in os.environ or
        'MV2_COMM_WORLD_LOCAL_RANK' in os.environ or
        'PMI_RANK' in os.environ or
        'ALPS_APP_PE' in os.environ):
        inside_mpi_job = True

    # only open python stdout/stderr in non-MPI runs
    if not inside_mpi_job:
        msg.openPython();

    if options.notice_level is not None:
        msg.setNoticeLevel(options.notice_level);

    if options.msg_file is not None:
        msg.openFile(options.msg_file);

    if options.shared_msg_file is not None:
        if not _hoomd.is_MPI_available():
            hoomd.context.msg.error("Shared log files are only available in MPI builds.\n");
            raise RuntimeError('Error setting option');
        msg.setSharedFile(options.shared_msg_file);

    return msg
Ejemplo n.º 2
0
def _create_messenger(mpi_config, notice_level, msg_file, shared_msg_file):
    msg = _hoomd.Messenger(mpi_config)

    # try to detect if we're running inside an MPI job
    inside_mpi_job = mpi_config.getNRanksGlobal() > 1
    if ('OMPI_COMM_WORLD_RANK' in os.environ
            or 'MV2_COMM_WORLD_LOCAL_RANK' in os.environ
            or 'PMI_RANK' in os.environ or 'ALPS_APP_PE' in os.environ):
        inside_mpi_job = True

    # only open python stdout/stderr in non-MPI runs
    if not inside_mpi_job:
        msg.openPython()

    if notice_level is not None:
        msg.setNoticeLevel(notice_level)

    if msg_file is not None:
        msg.openFile(msg_file)

    if shared_msg_file is not None:
        if not hoomd.version.mpi_enabled:
            raise RuntimeError(
                'Shared log files are only available in MPI builds.')
        msg.setSharedFile(shared_msg_file)

    return msg
Ejemplo n.º 3
0
def _create_messenger(mpi_config, notice_level, msg_file):
    msg = _hoomd.Messenger(mpi_config)

    # try to detect if we're running inside an MPI job
    inside_mpi_job = mpi_config.getNRanksGlobal() > 1

    # only open python stdout/stderr in non-MPI runs
    if not inside_mpi_job:
        msg.openPython()

    if notice_level is not None:
        msg.setNoticeLevel(notice_level)

    if msg_file is not None:
        msg.openFile(msg_file)

    return msg
Ejemplo n.º 4
0
from hoomd import _hoomd
from hoomd import cite
import socket
import getpass
import platform

# The following global variables keep track of the walltime and processing time since the import of hoomd_script
import time

TIME_START = time.time()
CLOCK_START = time.clock()

## Global Messenger
# \note This is initialized to a default messenger on load so that python code may have a unified path for sending
# messages
msg = _hoomd.Messenger()

# only use python stdout/stderr in non-mpi runs
if not ('OMPI_COMM_WORLD_RANK' in os.environ
        or 'MV2_COMM_WORLD_LOCAL_RANK' in os.environ
        or 'PMI_RANK' in os.environ or 'ALPS_APP_PE' in os.environ):
    msg.openPython()

## Global bibliography
bib = None

## Global options
options = None

## Global variable that holds the execution configuration for reference by the python API
exec_conf = None