Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HPC_Imaging
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Claudio Gheller
HPC_Imaging
Commits
90ef6004
Commit
90ef6004
authored
3 years ago
by
Claudio Gheller
Browse files
Options
Downloads
Patches
Plain Diff
openmp (CPU) added to phase correction
parent
eacb3f9e
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
phase_correction.cu
+13
-2
13 additions, 2 deletions
phase_correction.cu
w-stacking-fftw.c
+1
-1
1 addition, 1 deletion
w-stacking-fftw.c
w-stacking.h
+2
-1
2 additions, 1 deletion
w-stacking.h
with
16 additions
and
4 deletions
phase_correction.cu
+
13
−
2
View file @
90ef6004
...
@@ -87,7 +87,7 @@ __global__ void phase_g(int xaxis,
...
@@ -87,7 +87,7 @@ __global__ void phase_g(int xaxis,
#endif
#endif
void
phase_correction
(
double
*
gridss
,
double
*
image_real
,
double
*
image_imag
,
int
xaxis
,
int
yaxis
,
int
num_w_planes
,
int
xaxistot
,
int
yaxistot
,
void
phase_correction
(
double
*
gridss
,
double
*
image_real
,
double
*
image_imag
,
int
xaxis
,
int
yaxis
,
int
num_w_planes
,
int
xaxistot
,
int
yaxistot
,
double
resolution
,
double
wmin
,
double
wmax
)
double
resolution
,
double
wmin
,
double
wmax
,
int
num_threads
)
{
{
double
dw
=
(
wmax
-
wmin
)
/
(
double
)
num_w_planes
;
double
dw
=
(
wmax
-
wmin
)
/
(
double
)
num_w_planes
;
double
wterm
=
wmin
+
0.5
*
dw
;
double
wterm
=
wmin
+
0.5
*
dw
;
...
@@ -135,6 +135,11 @@ void phase_correction(double* gridss, double* image_real, double* image_imag, in
...
@@ -135,6 +135,11 @@ void phase_correction(double* gridss, double* image_real, double* image_imag, in
#else
#else
#ifdef _OPENMP
omp_set_num_threads
(
num_threads
);
#endif
#pragma omp parallel for collapse(3) private(wterm)
for
(
int
iw
=
0
;
iw
<
num_w_planes
;
iw
++
)
for
(
int
iw
=
0
;
iw
<
num_w_planes
;
iw
++
)
{
{
for
(
int
iv
=
0
;
iv
<
yaxis
;
iv
++
)
for
(
int
iv
=
0
;
iv
<
yaxis
;
iv
++
)
...
@@ -143,6 +148,7 @@ void phase_correction(double* gridss, double* image_real, double* image_imag, in
...
@@ -143,6 +148,7 @@ void phase_correction(double* gridss, double* image_real, double* image_imag, in
long
index
=
2
*
(
iu
+
iv
*
xaxis
+
xaxis
*
yaxis
*
iw
);
long
index
=
2
*
(
iu
+
iv
*
xaxis
+
xaxis
*
yaxis
*
iw
);
long
img_index
=
iu
+
iv
*
xaxis
;
long
img_index
=
iu
+
iv
*
xaxis
;
wterm
=
wmin
+
iw
*
dw
;
#ifdef PHASE_ON
#ifdef PHASE_ON
if
(
num_w_planes
>
1
)
if
(
num_w_planes
>
1
)
{
{
...
@@ -166,19 +172,24 @@ void phase_correction(double* gridss, double* image_real, double* image_imag, in
...
@@ -166,19 +172,24 @@ void phase_correction(double* gridss, double* image_real, double* image_imag, in
s
=
pimag
;
s
=
pimag
;
//printf("%d %d %d %ld %ld\n",iu,iv,iw,index,img_index);
//printf("%d %d %d %ld %ld\n",iu,iv,iw,index,img_index);
#pragma omp atomic
image_real
[
img_index
]
+=
(
p
*
r
-
q
*
s
)
*
dwnorm
*
sqrt
(
1
-
radius2
);
image_real
[
img_index
]
+=
(
p
*
r
-
q
*
s
)
*
dwnorm
*
sqrt
(
1
-
radius2
);
#pragma omp atomic
image_imag
[
img_index
]
+=
(
p
*
s
+
q
*
r
)
*
dwnorm
*
sqrt
(
1
-
radius2
);
image_imag
[
img_index
]
+=
(
p
*
s
+
q
*
r
)
*
dwnorm
*
sqrt
(
1
-
radius2
);
}
else
{
}
else
{
#pragma omp atomic
image_real
[
img_index
]
+=
gridss
[
index
];
image_real
[
img_index
]
+=
gridss
[
index
];
#pragma omp atomic
image_imag
[
img_index
]
+=
gridss
[
index
+
1
];
image_imag
[
img_index
]
+=
gridss
[
index
+
1
];
}
}
#else
#else
#pragma omp atomic
image_real
[
img_index
]
+=
gridss
[
index
];
image_real
[
img_index
]
+=
gridss
[
index
];
#pragma omp atomic
image_imag
[
img_index
]
+=
gridss
[
index
+
1
];
image_imag
[
img_index
]
+=
gridss
[
index
+
1
];
#endif // end of PHASE_ON
#endif // end of PHASE_ON
}
}
wterm
+=
dw
;
}
}
#endif // end of __CUDACC__
#endif // end of __CUDACC__
...
...
This diff is collapsed.
Click to expand it.
w-stacking-fftw.c
+
1
−
1
View file @
90ef6004
...
@@ -860,7 +860,7 @@ int main(int argc, char * argv[])
...
@@ -860,7 +860,7 @@ int main(int argc, char * argv[])
double
*
image_real
=
(
double
*
)
calloc
(
xaxis
*
yaxis
,
sizeof
(
double
));
double
*
image_real
=
(
double
*
)
calloc
(
xaxis
*
yaxis
,
sizeof
(
double
));
double
*
image_imag
=
(
double
*
)
calloc
(
xaxis
*
yaxis
,
sizeof
(
double
));
double
*
image_imag
=
(
double
*
)
calloc
(
xaxis
*
yaxis
,
sizeof
(
double
));
phase_correction
(
gridss
,
image_real
,
image_imag
,
xaxis
,
yaxis
,
num_w_planes
,
grid_size_x
,
grid_size_y
,
resolution
,
wmin
,
wmax
);
phase_correction
(
gridss
,
image_real
,
image_imag
,
xaxis
,
yaxis
,
num_w_planes
,
grid_size_x
,
grid_size_y
,
resolution
,
wmin
,
wmax
,
num_threads
);
end
=
clock
();
end
=
clock
();
clock_gettime
(
CLOCK_MONOTONIC
,
&
finish
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
finish
);
...
...
This diff is collapsed.
Click to expand it.
w-stacking.h
+
2
−
1
View file @
90ef6004
...
@@ -46,5 +46,6 @@ void phase_correction(
...
@@ -46,5 +46,6 @@ void phase_correction(
int
,
int
,
double
,
double
,
double
,
double
,
double
);
double
,
int
);
#endif
#endif
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