Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenSource
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
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Willem Thorbecke
OpenSource
Commits
75735166
Commit
75735166
authored
5 years ago
by
JanThorbecke
Browse files
Options
Downloads
Patches
Plain Diff
OpenMP over nshots
parent
af7deb0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
marchenko3D/synthesis3D.c
+24
-26
24 additions, 26 deletions
marchenko3D/synthesis3D.c
with
24 additions
and
26 deletions
marchenko3D/synthesis3D.c
+
24
−
26
View file @
75735166
...
@@ -168,10 +168,10 @@ long *ixpos, long *iypos, long npos, double *tfft, long *isxcount, long *reci_xs
...
@@ -168,10 +168,10 @@ long *ixpos, long *iypos, long npos, double *tfft, long *isxcount, long *reci_xs
#ifdef _OPENMP
#ifdef _OPENMP
npe
=
(
long
)
omp_get_max_threads
();
npe
=
(
long
)
omp_get_max_threads
();
/* parallelisation is over number of
virtual source
positions (
Nfoc
) */
/* parallelisation is over number of
shot
positions (
nshots
) */
if
(
npe
>
Nfoc
)
{
if
(
npe
>
nshots
)
{
vmess
(
"Number of OpenMP threads set to %li (was %li)"
,
Nfoc
,
npe
);
vmess
(
"Number of OpenMP threads set to %li (was %li)"
,
nshots
,
npe
);
omp_set_num_threads
((
int
)
Nfoc
);
omp_set_num_threads
((
int
)
nshots
);
}
}
#endif
#endif
...
@@ -226,27 +226,28 @@ long *ixpos, long *iypos, long npos, double *tfft, long *isxcount, long *reci_xs
...
@@ -226,27 +226,28 @@ long *ixpos, long *iypos, long npos, double *tfft, long *isxcount, long *reci_xs
t1
=
wallclock_time
();
t1
=
wallclock_time
();
*
tfft
+=
t1
-
t0
;
*
tfft
+=
t1
-
t0
;
/* Loop over total number of shots */
if
(
reci
==
0
||
reci
==
1
)
{
if
(
reci
==
0
||
reci
==
1
)
{
for
(
k
=
0
;
k
<
nshots
;
k
++
)
{
if
((
xsrc
[
k
]
<
fxb
)
||
(
xsrc
[
k
]
>
fxe
)
||
(
ysrc
[
k
]
<
fyb
)
||
(
ysrc
[
k
]
>
fye
))
continue
;
isrc
=
NINT
((
ysrc
[
k
]
-
fysb
)
/
dys
)
*
nxs
+
NINT
((
xsrc
[
k
]
-
fxsb
)
/
dxs
);
inx
=
xnx
[
k
];
/* number of traces per shot */
/*================ SYNTHESIS ================*/
/*================ SYNTHESIS ================*/
#pragma omp parallel default(none) \
#pragma omp parallel default(none) \
shared(iRN, dx, dy, npe, nw, verbose) \
shared(iRN, dx, dy, npe, nw,
nshots,
verbose) \
shared(Refl, Nfoc, reci, xrcv, xsrc, yrcv, ysrc, xsyn, ysyn) \
shared(Refl, Nfoc, reci, xrcv, xsrc, yrcv, ysrc, xsyn, ysyn) \
shared(fxsb, fxse, fysb, fyse, nxs, nys, nxys, dxs, dys) \
shared(fxsb, fxse, fysb, fyse, nxs, nys, nxys, dxs, dys) \
shared(nx, ny, nxy, dysrc, dxsrc,
inx, k,
nfreq, nw_low, nw_high) \
shared(nx, ny, nxy, dysrc, dxsrc, nfreq, nw_low, nw_high
, xnx
) \
shared(Fop, size, nts, ntfft, scl, iyrcv, ixrcv,
isrc
) \
shared(Fop, size, nts, ntfft, scl, iyrcv, ixrcv,
fxb, fxe, fyb, fye
) \
private(l, ix, iy, j, m, i, sum, rtrace)
private(l, ix, iy, j, m, i, sum, rtrace
, k, isrc, inx
)
{
/* start of parallel region */
{
/* start of parallel region */
sum
=
(
complex
*
)
malloc
(
nfreq
*
sizeof
(
complex
));
sum
=
(
complex
*
)
malloc
(
nfreq
*
sizeof
(
complex
));
rtrace
=
(
float
*
)
calloc
(
ntfft
,
sizeof
(
float
));
rtrace
=
(
float
*
)
calloc
(
ntfft
,
sizeof
(
float
));
/* Loop over total number of shots */
#pragma omp for schedule(guided,1)
#pragma omp for schedule(guided,1)
for
(
k
=
0
;
k
<
nshots
;
k
++
)
{
if
((
xsrc
[
k
]
<
fxb
)
||
(
xsrc
[
k
]
>
fxe
)
||
(
ysrc
[
k
]
<
fyb
)
||
(
ysrc
[
k
]
>
fye
))
continue
;
isrc
=
NINT
((
ysrc
[
k
]
-
fysb
)
/
dys
)
*
nxs
+
NINT
((
xsrc
[
k
]
-
fxsb
)
/
dxs
);
inx
=
xnx
[
k
];
/* number of traces per shot */
for
(
l
=
0
;
l
<
Nfoc
;
l
++
)
{
for
(
l
=
0
;
l
<
Nfoc
;
l
++
)
{
/* compute integral over receiver positions */
/* compute integral over receiver positions */
/* multiply R with Fop and sum over nx */
/* multiply R with Fop and sum over nx */
...
@@ -269,19 +270,16 @@ long *ixpos, long *iypos, long npos, double *tfft, long *isxcount, long *reci_xs
...
@@ -269,19 +270,16 @@ long *ixpos, long *iypos, long npos, double *tfft, long *isxcount, long *reci_xs
for
(
j
=
0
;
j
<
nts
;
j
++
)
for
(
j
=
0
;
j
<
nts
;
j
++
)
iRN
[
l
*
size
+
isrc
*
nts
+
j
]
+=
rtrace
[
j
]
*
scl
*
dx
*
dy
;
iRN
[
l
*
size
+
isrc
*
nts
+
j
]
+=
rtrace
[
j
]
*
scl
*
dx
*
dy
;
}
/* end of parallel Nfoc loop */
}
/* end of Nfoc loop */
free
(
sum
);
free
(
rtrace
);
#ifdef _OPENMP
if
(
verbose
>
4
)
vmess
(
"*** Shot gather %li processed ***"
,
k
);
#pragma omp single
npe
=
(
long
)
omp_get_num_threads
();
}
/* end of parallel nshots (k) loop */
#endif
free
(
sum
);
}
/* end of parallel region */
free
(
rtrace
);
if
(
verbose
>
4
)
vmess
(
"*** Shot gather %li processed ***"
,
k
);
}
/* end of parallel region */
}
/* end of nshots (k) loop */
}
/* end of if reci */
}
/* end of if reci */
t
=
wallclock_time
()
-
t0
;
t
=
wallclock_time
()
-
t0
;
...
@@ -290,4 +288,4 @@ long *ixpos, long *iypos, long npos, double *tfft, long *isxcount, long *reci_xs
...
@@ -290,4 +288,4 @@ long *ixpos, long *iypos, long npos, double *tfft, long *isxcount, long *reci_xs
}
}
return
;
return
;
}
}
\ No newline at end of file
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