Ignore:
Timestamp:
Oct 28, 2005 1:59:39 PM (14 years ago)
Author:
andreasw
Message:

added latest changes proposed by Olaf Schenk in PardisoInterface?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev/Algorithm/LinearSolvers/IpPardisoSolverInterface.cpp

    r548 r553  
    2020# else
    2121#  error "don't have header file for math"
     22# endif
     23#endif
     24
     25#ifdef HAVE_CSTDLIB
     26# include <cstdlib>
     27#else
     28# ifdef HAVE_STDLIB_H
     29#  include <stdlib.h>
     30# else
     31#  error "don't have header file for stdlib"
    2232# endif
    2333#endif
     
    112122    // Set some parameters for Pardiso
    113123    IPARM_[0] = 1;  // Don't use the default values
    114     IPARM_[2] = 1;  // Only one CPU for now
     124
     125    // Obtain the numbers of processors from the value of OMP_NUM_THREADS
     126    char    *var = getenv("OMP_NUM_THREADS");
     127    int      num_procs;
     128    if(var != NULL) {
     129      sscanf( var, "%d", &num_procs );
     130      Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA,
     131                     "Using environment OMP_NUM_THREADS = %d as the number of processors.\n", num_procs);
     132    }
     133    else {
     134      Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA,
     135                     "You need to set environment variable OMP_NUM_THREADS to the number of processors used in Pardiso (e.g., 1).");
     136      return false;
     137    }
     138    IPARM_[2] = num_procs;  // Set the number of processors
    115139    IPARM_[5] = 1;  // Overwrite right-hand side
    116140    // ToDo: decide if we need iterative refinement in Pardiso.  For
     
    127151
    128152    IPARM_[20] = 1;
     153    IPARM_[23] = 1; // parallel fac
     154    IPARM_[24] = 1; // parallel solve
    129155
    130156    return true;
Note: See TracChangeset for help on using the changeset viewer.