Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
6b5fa721
Commit
6b5fa721
authored
Aug 11, 2010
by
Uwe Schulzweida
Browse files
MACOSX: call omp_set_num_threads only in master thread
parent
3e502500
Changes
3
Hide whitespace changes
Inline
Side-by-side
config/default
View file @
6b5fa721
...
...
@@ -31,7 +31,7 @@ case "${HOSTNAME}" in
--with-hdf5
=
/opt/local
\
--with-szlib
=
/opt/local
\
--with-proj
=
/opt/local
\
CC
=
gcc
CFLAGS
=
"-g -pipe -D_REENTRANT -Wall -W -Wfloat-equal -pedantic -O2"
CC
=
gcc
CFLAGS
=
"-g -pipe -D_REENTRANT -Wall -W -Wfloat-equal -pedantic -O2
-fopenmp
"
;;
# ia64-xxx-linux
ds
*
)
...
...
src/cdo.c
View file @
6b5fa721
...
...
@@ -955,7 +955,7 @@ int main(int argc, char *argv[])
omp_set_num_threads
(
numThreads
);
ompNumThreads
=
omp_get_max_threads
();
if
(
omp_get_max_threads
()
>
omp_get_num_procs
()
)
fprintf
(
stderr
,
" Number of threads is greater than number of CPUs=%d!
\n
"
,
omp_get_num_procs
());
fprintf
(
stderr
,
"
Warning:
Number of
OMP
threads is greater than number of CPUs=%d!
\n
"
,
omp_get_num_procs
());
if
(
cdoVerbose
)
fprintf
(
stderr
,
" OpenMP: num_procs = %d max_threads = %d
\n
"
,
omp_get_num_procs
(),
omp_get_max_threads
());
...
...
src/pstream.c
View file @
6b5fa721
...
...
@@ -332,6 +332,7 @@ int pstreamOpenRead(const char *argument)
int
rval
;
pthread_t
thrID
;
pthread_attr_t
attr
;
struct
sched_param
param
;
size_t
len
;
size_t
stacksize
;
int
status
;
...
...
@@ -359,7 +360,11 @@ int pstreamOpenRead(const char *argument)
if
(
status
)
SysError
(
func
,
"pthread_attr_init failed for '%s'
\n
"
,
newarg
+
1
);
status
=
pthread_attr_setdetachstate
(
&
attr
,
PTHREAD_CREATE_JOINABLE
);
if
(
status
)
SysError
(
func
,
"pthread_attr_setdetachstate failed for '%s'
\n
"
,
newarg
+
1
);
/*
param.sched_priority = 0;
status = pthread_attr_setschedparam(&attr, ¶m);
if ( status ) SysError(func, "pthread_attr_setschedparam failed for '%s'\n", newarg+1);
*/
/* status = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); */
/* if ( status ) SysError(func, "pthread_attr_setinheritsched failed for '%s'\n", newarg+1); */
...
...
@@ -1355,7 +1360,9 @@ void cdoInitialize(void *argument)
int
processID
;
#if defined (_OPENMP)
#if !(defined __APPLE__ && defined __MACH__)
omp_set_num_threads
(
ompNumThreads
);
/* Have to be called for every module (pthread)! */
#endif
#endif
processID
=
processCreate
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment