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
ift
nifty_gridder
Commits
3533fd55
Commit
3533fd55
authored
Oct 07, 2019
by
Martin Reinecke
Browse files
fix non-OpenMP mode
parent
bf42bc10
Changes
1
Show whitespace changes
Inline
Side-by-side
gridder_cxx.h
View file @
3533fd55
...
...
@@ -739,6 +739,9 @@ class Lock
void
lock
()
{
omp_set_lock
(
&
lck
);
}
void
unlock
()
{
omp_unset_lock
(
&
lck
);
}
};
int
my_max_threads
()
{
return
omp_get_max_threads
();
}
int
my_num_threads
()
{
return
omp_get_num_threads
();
}
int
my_thread_num
()
{
return
omp_get_thread_num
();
}
#else
class
Lock
{
...
...
@@ -746,8 +749,11 @@ class Lock
Lock
()
{}
~
Lock
()
{}
void
lock
()
{}
void
unlock
{}
void
unlock
()
{}
};
int
my_max_threads
()
{
return
1
;
}
int
my_num_threads
()
{
return
1
;
}
int
my_thread_num
()
{
return
0
;
}
#endif
template
<
typename
T
,
typename
T2
=
complex
<
T
>
>
class
Helper
...
...
@@ -1315,7 +1321,11 @@ template<typename Serv> void wstack_common(
double
wmax
;
wminmax
(
gconf
,
srv
,
wmin
,
wmax
);
#ifdef _OPENMP
if
(
verbosity
>
0
)
cout
<<
"Using "
<<
nthreads
<<
" threads"
<<
endl
;
#else
if
(
verbosity
>
0
)
cout
<<
"Using single-threaded mode"
<<
endl
;
#endif
if
(
verbosity
>
0
)
cout
<<
"W range: "
<<
wmin
<<
" to "
<<
wmax
<<
endl
;
double
x0
=
-
0.5
*
gconf
.
Nxdirty
()
*
gconf
.
Pixsize_x
(),
y0
=
-
0.5
*
gconf
.
Nydirty
()
*
gconf
.
Pixsize_y
();
...
...
@@ -1333,12 +1343,12 @@ template<typename Serv> void wstack_common(
nvis_plane
.
resize
(
nplanes
,
0
);
minplane
.
resize
(
nplanes
);
vector
<
size_t
>
tcnt
(
omp_get
_max_threads
()
*
nplanes
,
0
);
vector
<
size_t
>
tcnt
(
my
_max_threads
()
*
nplanes
,
0
);
#pragma omp parallel num_threads(nthreads)
{
vector
<
size_t
>
mytcnt
(
nplanes
,
0
);
vector
<
size_t
>
nvp
(
nplanes
,
0
);
auto
mythread
=
omp_get
_thread_num
();
auto
mythread
=
my
_thread_num
();
#pragma omp for schedule(static)
for
(
size_t
ipart
=
0
;
ipart
<
nvis
;
++
ipart
)
{
...
...
@@ -1359,7 +1369,7 @@ template<typename Serv> void wstack_common(
for
(
size_t
j
=
0
;
j
<
nplanes
;
++
j
)
{
size_t
l
=
0
;
for
(
size_t
i
=
0
;
i
<
n
threads
;
++
i
)
for
(
size_t
i
=
0
;
i
<
my_num_
threads
()
;
++
i
)
l
+=
tcnt
[
i
*
nplanes
+
j
];
minplane
[
j
].
resize
(
l
);
}
...
...
Write
Preview
Markdown
is supported
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