call omp_set_num_threads once in central place instead in model routines

This commit is contained in:
dwarning 2012-06-15 23:14:08 +02:00
parent 72afda41ad
commit 9648238ed7
9 changed files with 16 additions and 61 deletions

View File

@ -15,7 +15,11 @@ Author: 1985 Thomas L. Quarles
#include "ngspice/devdefs.h"
#include "ngspice/sperror.h"
#ifdef USE_OMP
#include <omp.h>
#include "ngspice/cpextern.h"
int nthreads;
#endif
#define CKALLOC(var,size,type) \
if(size && ((var = TMALLOC(type, size)) == NULL)){\
@ -58,6 +62,17 @@ CKTsetup(CKTcircuit *ckt)
matrix = ckt->CKTmatrix;
#ifdef USE_OMP
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
nthreads = 2;
omp_set_num_threads(nthreads);
if (nthreads == 1)
printf("OpenMP: %d thread is requested in ngspice\n", nthreads);
else
printf("OpenMP: %d threads are requested in ngspice\n", nthreads);
#endif
for (i=0;i<DEVmaxnum;i++) {
#ifdef HAS_WINDOWS
SetAnalyse( "Device Setup", 0 );

View File

@ -17,10 +17,6 @@
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#ifdef USE_OMP
#include "ngspice/cpextern.h"
#endif
#define MAX_EXP 5.834617425e14
#define MIN_EXP 1.713908431e-15
#define EXP_THRESHOLD 34.0
@ -48,7 +44,6 @@ IFuid tmpName;
#ifdef USE_OMP
unsigned int idx, InstCount;
BSIM3instance **InstArray;
int nthreads;
#endif
@ -1015,14 +1010,6 @@ if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
}
}
#ifdef USE_OMP
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
nthreads = 2;
omp_set_num_threads(nthreads);
if (nthreads == 1)
printf("OpenMP: %d thread is requested in BSIM3\n", nthreads);
else
printf("OpenMP: %d threads are requested in BSIM3\n", nthreads);
InstCount = 0;
model = (BSIM3model*)inModel;
/* loop through all the BSIM3 device models

View File

@ -16,10 +16,6 @@ File: bsim3def.h
#include "ngspice/complex.h"
#include "ngspice/noisedef.h"
#ifdef USE_OMP
#include <omp.h>
#endif
typedef struct sBSIM3instance
{
struct sBSIM3model *BSIM3modPtr;

View File

@ -24,10 +24,6 @@ File: b4soidef.h
#include "ngspice/complex.h"
#include "ngspice/noisedef.h"
#ifdef USE_OMP
#include <omp.h>
#endif
typedef struct sB4SOIinstance
{
struct sB4SOImodel *B4SOImodPtr;

View File

@ -25,10 +25,6 @@
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#ifdef USE_OMP
#include "ngspice/cpextern.h"
#endif
#define SMOOTHFACTOR 0.1
#define EPSOX 3.453133e-11
#define EPSSI 1.03594e-10
@ -60,7 +56,6 @@ double Vbs0t, Qsi;
#ifdef USE_OMP
unsigned int idx, InstCount;
B4SOIinstance **InstArray;
int nthreads;
#endif
/* loop through all the B4SOI device models */
@ -2698,14 +2693,6 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\
}
#ifdef USE_OMP
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
nthreads = 2;
omp_set_num_threads(nthreads);
if (nthreads == 1)
printf("OpenMP: %d thread is requested in B4SOI\n", nthreads);
else
printf("OpenMP: %d threads are requested in B4SOI\n", nthreads);
InstCount = 0;
model = (B4SOImodel*)inModel;
/* loop through all the B4SOI device models

View File

@ -61,7 +61,6 @@ JOB *job;
#ifdef USE_OMP
unsigned int idx, InstCount;
BSIM4instance **InstArray;
int nthreads;
#endif
/* Search for a noise analysis request */
@ -2547,14 +2546,6 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\
}
#ifdef USE_OMP
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
nthreads = 2;
omp_set_num_threads(nthreads);
if (nthreads == 1)
printf("OpenMP: %d thread is requested in BSIM4\n", nthreads);
else
printf("OpenMP: %d threads are requested in BSIM4\n", nthreads);
InstCount = 0;
model = (BSIM4model*)inModel;
/* loop through all the BSIM4 device models

View File

@ -28,10 +28,6 @@ Modified by Wenwei Yang, 07/31/2008.
#include "ngspice/complex.h"
#include "ngspice/noisedef.h"
#ifdef USE_OMP
#include <omp.h>
#endif
typedef struct sBSIM4instance
{
struct sBSIM4model *BSIM4modPtr;

View File

@ -62,7 +62,6 @@ JOB *job;
#ifdef USE_OMP
unsigned int idx, InstCount;
BSIM4v6instance **InstArray;
int nthreads;
#endif
/* Search for a noise analysis request */
@ -2395,14 +2394,6 @@ if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
} /* end of loop through all the BSIM4v6 device models */
#ifdef USE_OMP
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
nthreads = 2;
omp_set_num_threads(nthreads);
if (nthreads == 1)
printf("OpenMP: %d thread is requested in BSIM4v6\n", nthreads);
else
printf("OpenMP: %d threads are requested in BSIM4v6\n", nthreads);
InstCount = 0;
model = (BSIM4v6model*)inModel;
/* loop through all the BSIM4v6 device models

View File

@ -27,10 +27,6 @@ Modified by Wenwei Yang, 07/31/2008.
#include "ngspice/complex.h"
#include "ngspice/noisedef.h"
#ifdef USE_OMP
#include <omp.h>
#endif
typedef struct sBSIM4v6instance
{
struct sBSIM4v6model *BSIM4v6modPtr;