Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DP3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
DP3
Commits
81aadd7c
Commit
81aadd7c
authored
1 year ago
by
Bram Veenboer
Browse files
Options
Downloads
Patches
Plain Diff
Replace ParallelFor by StaticFor
parent
677b48c6
No related branches found
No related tags found
No related merge requests found
Pipeline
#63725
failed
1 year ago
Stage: versioning
Stage: prepare
Stage: build
Stage: linting
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
idg/Imager.cc
+11
-11
11 additions, 11 deletions
idg/Imager.cc
with
11 additions
and
11 deletions
idg/Imager.cc
+
11
−
11
View file @
81aadd7c
// Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
// SPDX-License-Identifier: GPL-3.0-or-later
#include
<aocommon/
parallel
for.h>
#include
<aocommon/
static
for.h>
#include
<fftw3.h>
#include
<algorithm>
...
...
@@ -108,7 +108,7 @@ void WeighVisibilities(size_t n_threads,
assert
(
uv_pixels
.
shape
()[
1
]
==
n_baselines
);
assert
(
uv_pixels
.
shape
()[
2
]
==
n_channels
);
aocommon
::
Parallel
For
<
size_t
>
loop
(
n_threads
);
aocommon
::
Static
For
<
size_t
>
loop
(
n_threads
);
loop
.
Run
(
0
,
n_baselines
,
[
&
](
size_t
bl
,
size_t
/*thread*/
)
{
for
(
size_t
chan
=
0
;
chan
<
n_channels
;
++
chan
)
{
for
(
size_t
cor
=
0
;
cor
<
n_correlations
;
++
cor
)
{
...
...
@@ -160,7 +160,7 @@ void VisibilitiesToSubgrids(
const
xt
::
xtensor
<
float
,
1
>
wavenumbers
=
ComputeWavenumbers
(
frequencies
);
aocommon
::
Parallel
For
<
size_t
>
loop
(
n_threads
);
aocommon
::
Static
For
<
size_t
>
loop
(
n_threads
);
loop
.
Run
(
0
,
n_baselines
,
[
&
](
size_t
bl
,
size_t
/*thread*/
)
{
// Load metadata
const
SubgridMetadata
m
=
metadata
(
bl
);
...
...
@@ -226,7 +226,7 @@ void ApplySubgridFFT(size_t n_threads,
fftwf_complex
*
out
=
in
;
plan
=
fftwf_plan_dft_2d
(
size
,
size
,
in
,
out
,
sign
,
FFTW_ESTIMATE
);
aocommon
::
Parallel
For
<
size_t
>
loop
(
n_threads
);
aocommon
::
Static
For
<
size_t
>
loop
(
n_threads
);
loop
.
Run
(
0
,
n_subgrids
,
[
&
](
size_t
i
,
size_t
/*thread*/
)
{
fftwf_complex
*
subgrid
=
reinterpret_cast
<
fftwf_complex
*>
(
&
subgrids
(
i
,
0
,
0
));
...
...
@@ -247,7 +247,7 @@ void SubgridsToGrid(size_t n_threads, size_t subgrid_size, size_t grid_size,
const
xt
::
xtensor
<
SubgridMetadata
,
1
>&
metadata
,
const
xt
::
xtensor
<
std
::
complex
<
float
>
,
3
>&
subgrids
,
xt
::
xtensor
<
std
::
complex
<
float
>
,
2
>&
grid
)
{
aocommon
::
Parallel
For
<
size_t
>
loop
(
n_threads
);
aocommon
::
Static
For
<
size_t
>
loop
(
n_threads
);
const
size_t
nr_subgrids
=
metadata
.
size
();
...
...
@@ -279,7 +279,7 @@ void SubgridsToTiles(size_t n_threads, size_t tile_size, size_t grid_size,
const
size_t
subgrid_size
=
subgrids
.
shape
()[
1
];
assert
(
subgrid_size
==
subgrids
.
shape
()[
2
]);
aocommon
::
Parallel
For
<
size_t
>
loop
(
n_threads
);
aocommon
::
Static
For
<
size_t
>
loop
(
n_threads
);
// Precompute phasor
xt
::
xtensor
<
float
,
2
>
phase
({
subgrid_size
,
subgrid_size
});
...
...
@@ -440,7 +440,7 @@ void ApplyGridFFT(size_t n_threads, xt::xtensor<std::complex<float>, 2>& in,
fftwf_plan
plan
=
fftwf_plan_dft_1d
(
size
,
nullptr
,
nullptr
,
sign
,
FFTW_ESTIMATE
);
aocommon
::
Parallel
For
<
size_t
>
loop
(
n_threads
);
aocommon
::
Static
For
<
size_t
>
loop
(
n_threads
);
xt
::
xtensor
<
std
::
complex
<
float
>
,
2
>
temp
({
size
,
size
},
0
);
...
...
@@ -502,7 +502,7 @@ void ApplyPhasor(size_t tile_idx, float image_size, float w_step, float tile_z,
}
// end for y
}
// end ApplyPhasor
void
PaddedTilesToGrid
(
aocommon
::
Parallel
For
<
size_t
>&
loop
,
size_t
n_tiles
,
void
PaddedTilesToGrid
(
aocommon
::
Static
For
<
size_t
>&
loop
,
size_t
n_tiles
,
size_t
tile_offset
,
const
xt
::
xtensor
<
TileMetadata
,
1
>&
metadata
,
const
xt
::
xtensor
<
std
::
complex
<
float
>
,
3
>&
tiles
,
...
...
@@ -554,7 +554,7 @@ void TilesToGrid(size_t n_threads, float image_size, float w_step,
fftwf_plan
plan_backward
=
fftwf_plan_dft_1d
(
padded_tile_size
,
nullptr
,
nullptr
,
FFTW_BACKWARD
,
FFTW_ESTIMATE
);
aocommon
::
Parallel
For
<
size_t
>
loop
(
n_threads
);
aocommon
::
Static
For
<
size_t
>
loop
(
n_threads
);
const
size_t
n_tiles
=
tiles
.
shape
()[
0
];
size_t
current_n_tiles
=
0
;
...
...
@@ -632,7 +632,7 @@ void Imager::Initialize(const xt::xtensor<double, 1>& frequencies,
// Initialize per baseline metadata
subgrid_metadata_
.
resize
({
n_baselines
});
uv_pixels_
.
resize
({
2
,
n_baselines
,
n_channels
});
aocommon
::
Parallel
For
<
size_t
>
loop
(
1
);
aocommon
::
Static
For
<
size_t
>
loop
(
1
);
loop
.
Run
(
0
,
n_baselines
,
[
&
](
size_t
bl
,
size_t
/*thread*/
)
{
const
double
u_meters
=
uvw
(
bl
,
0
);
const
double
v_meters
=
uvw
(
bl
,
1
);
...
...
@@ -824,7 +824,7 @@ xt::xtensor<float, 2> Imager::GetImage() {
const
size_t
x_start
=
y_start
;
const
size_t
x_end
=
y_end
;
aocommon
::
Parallel
For
<
size_t
>
loop
(
n_threads_
);
aocommon
::
Static
For
<
size_t
>
loop
(
n_threads_
);
loop
.
Run
(
y_start
,
y_end
,
[
&
](
size_t
y
,
size_t
/*thread*/
)
{
for
(
size_t
x
=
x_start
;
x
<
x_end
;
++
x
)
{
const
size_t
y_src
=
(
y
+
(
padded_grid_size_
/
2
))
%
padded_grid_size_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment