Support Knowledge Base

Solution Number: 1001
Title: Running COMSOL in parallel mode
Platform: All Platforms
Applies to: All Products
Versions: 3.5, 3.5a
Created: November 21, 2006
Last Modified: April 22, 2009
Categories: Solver, Product Information, Mesh, Documentation
Keywords: solver memory parallel smp cluster

Problem Description

This solution describes how you enable parallel use of the processors on a multicore or multiprocessor computer.

Solution

Introduction

COMSOL 3.5 and later supports parallel computations on computers with multiple processors under the shared memory parallelization model (SMP), as well as distributed parallelism to nodes in a cluster (for parametric runs). Below are some practical tips how to use SMP parallelism.

SMP, Windows

On Windows platforms, the default number of processor cores used by COMSOL is the total number available cores. For example, if you have a 2 x dual core machine, 4 cores will be used in parallel by COMSOL Multiphysics by default.

Here is how to find out how many processor cores your Windows machine has:

  1. Right-click My Computer (on Vista: Computer), select Properties.
  2. Go to the Advanced tab (on Vista, first click click Advanced system settings).
  3. Click the Environment Variables button and look in the System variables list. Look for NUMBER_OF_PROCESSORS and check its value. This is actually the number of cores. If you have two processors with 2 cores each, this number will be 4.

If you want COMSOL to leave out one or more processor cores you can manually set the number of cores used:

  1. Create a shortcut on your Desktop to the COMSOL executable, for example
    C:\COMSOL35a\bin\comsol64.exe.
  2. Right click the shortcut and select Properties from the menu.
  3. Change the Target field to C:\COMSOL35a\bin\comsol64.exe -np # where you should replace # with the number of cores you wish to make available for the COMSOL application.

You can also change the default behavior of COMSOL by setting the environment variable COMSOL_NUM_THREADS to the desired number of cores. For details, see "Running COMSOL in Parallel" in the COMSOL Installation and Operations Guide.

SMP, Mac OS X

On Mac OS X, controlling the number of processor cores used by COMSOL is only possible when launching COMSOL from the Terminal. The default behavior is to use all available processor cores for the COMSOL Multiphysics application. You can find how many processor cores you have in the System Profiler application, or by using the command sysctl hw.ncpu. You can override the default behavior by using the command line switches. For example, start by the command comsol -np 2. Like in Windows, you can change the default behavior through the environment variable COMSOL_NUM_THREADS. Example: in C-shell, use the command setenv COMSOL_NUM_THREADS 2. For details, see "Running COMSOL in Parallel" in the COMSOL Installation and Operations Guide.

SMP, Linux/Sun

You can find out how many processors you have with the command
more /proc/cpuinfo | grep proc (Linux) or /usr/sbin/psrinfo -v (Sun-Solaris).

On Linux and Sun the default behavior is to use one (1) processor core for the COMSOL Multiphysics application. You can override the default behavior by using the command line switches. For example, start by the command comsol -np 2. Like in Windows, you can change the default behavior through the environment variable COMSOL_NUM_THREADS. Example: in C-shell, use the command setenv COMSOL_NUM_THREADS 2.

For a complete description of parallel processing in COMSOL Multiphysics, see "Running COMSOL in Parallel" in the COMSOL Installation and Operations Guide.

 

Feedback

Poor | Excellent
Document quality?




« Back to Support Knowledge Base

Disclaimer

COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.

COMSOL RSS
© 1998-2009 COMSOL AB.
COMSOL, COMSOL Multiphysics, COMSOL Reaction Engineering Lab and FEMLAB are registered trademarks of COMSOL AB.
Other product or brand names are trademarks or registered trademarks of their respective holders. All Rights Reserved.