Main Content

mpiSettings

Configure options for MPI communication

    Description

    example

    mpiSettings('DeadlockDetection',DeadlockDetection) toggles deadlock detection on workers on or off. When DeadlockDectection is on, a worker can return an error if a deadlock is detected during calls to spmdReceive and spmdSend. Although it is not necessary to enable deadlock detection on all workers, this is the most useful option.

    example

    mpiSettings('MessageLogging',MessageLogging) toggles message logging on workers on or off. When MessageLogging is on, the default message destination is MATLAB® Command Window.

    example

    mpiSettings('MessageLoggingDestination',MessageLoggingDestination) changes the MPI logging message logging destination. Options include MATLAB Command Window, the standard log file or a specified file.

    Examples

    collapse all

    Turn off deadlock detection for all workers in the current parallel pool in an spmd block.

    spmd
        mpiSettings('DeadlockDetection','off');
    end

    Set deadlock detection and MPI logging for a communicating job inside the jobStartup.m file for that job.

    The jobStartup.m file runs automatically on a worker before the job starts. For information about the jobStartup.m file, see jobStartup.

    Add the following code to the jobStartup.m file for the communicating job.

    mpiSettings('DeadlockDetection','on');
    myLogFname = sprintf('%s_%d.log',tempname,spmdIndex);
    mpiSettings('MessageLoggingDestination','File',myLogFname);
    mpiSettings('MessageLogging','on');

    Input Arguments

    collapse all

    Deadlock detection option during communication between workers, specified as a comma separated pair of DeadlockDetection and one of these values:

    • 'on' – Enable deadlock detection. This is the default state inside spmd statements.

    • 'off' – Disable deadlock detection. This is the default state for communicating jobs.

    Once the setting has been changed for a worker in a parallel pool, the setting stays in effect until the parallel pool is closed.

    If you are using a large number of workers, you might experience a performance increase if you disable deadlock detection. If some workers do not call spmdSend or spmdReceive for long periods of times, deadlock detection can cause communication errors. If you encounter errors, try disabling deadlock detection.

    Example: spmd;mpiSettings('DeadlockDetection','off');end;

    Data Types: logical

    MPI message logging option during communication between workers, specified as a comma separated pair of MessageLogging and one of these values:

    • 'on' – Enable MessageLogging

    • 'off' – Disable MessageLogging

    Data Types: logical

    Destination of log messages, specified as a comma separated pair of MessageLoggingDestination and one of these options:

    • 'CommandWindow' – Send MPI logging information to the MATLAB Command Window. If the task within a communicating job is set to capture Command Window output, you can find the MPI logging information in the task's CommandWindowOutput property.

    • 'stdout' – Send MPI logging information to the standard output for the MATLAB process. If you are using a MATLAB Job Scheduler, this is the mjs service log file.

    • 'File','filename' – Send MPI logging information to the file specified as filename.

    If you set MessageLoggingDestination, this does not automatically enable MessageLogging. A separate function call is required to enable message logging.

    Tips

    • Setting the MessageLoggingDestination does not automatically enable message logging. A separate call is required to enable message logging.

    • You must call the mpiSettings function on the worker, not the client. To change MPI communication settings within a communicating job, use mpiSettings in the task function, or in the user-defined options in the jobStartup.m, and taskStartup.m files.

      To change the MPI communication settings for all workers in a parallel pool, use mpiSettings in the poolStartup file.

      For more information, see the jobStartup, taskStartup, and poolStartup functions.

    Version History

    Introduced before R2006a