Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TurTLE
TurTLE
Commits
ecb66486
Commit
ecb66486
authored
Oct 04, 2017
by
Chichi Lalescu
Browse files
Merge branch 'update/split_fftw_mpi_many' into develop
parents
ffa26d9b
a2c93107
Pipeline
#19230
failed with stage
in 6 minutes and 27 seconds
Changes
8
Pipelines
2
Expand all
Hide whitespace changes
Inline
Side-by-side
bfps/cpp/fftw_interface.hpp
View file @
ecb66486
This diff is collapsed.
Click to expand it.
bfps/cpp/field.cpp
View file @
ecb66486
...
...
@@ -77,7 +77,7 @@ field<rnumber, be, fc>::field(
ptrdiff_t
local_n0
,
local_0_start
;
ptrdiff_t
local_n1
,
local_1_start
;
//tmp_local_size = fftw_mpi_local_size_many_transposed(
fftw_mpi_local_size_many_transposed
(
fftw_
interface
<
rnumber
>::
mpi_local_size_many_transposed
(
3
,
nfftw
,
ncomp
(
fc
),
FFTW_MPI_DEFAULT_BLOCK
,
FFTW_MPI_DEFAULT_BLOCK
,
this
->
comm
,
&
local_n0
,
&
local_0_start
,
...
...
bfps/cpp/field.hpp
View file @
ecb66486
...
...
@@ -72,8 +72,8 @@ class field
field_layout
<
fc
>
*
clayout
,
*
rlayout
,
*
rmemlayout
;
/* FFT plans */
typename
fftw_interface
<
rnumber
>::
plan
c2r_plan
;
typename
fftw_interface
<
rnumber
>::
plan
r2c_plan
;
typename
fftw_interface
<
rnumber
>::
many_
plan
c2r_plan
;
typename
fftw_interface
<
rnumber
>::
many_
plan
r2c_plan
;
unsigned
fftw_plan_rigor
;
/* HDF5 data types for arrays */
...
...
bfps/cpp/field_descriptor.cpp
View file @
ecb66486
...
...
@@ -62,7 +62,7 @@ field_descriptor<rnumber>::field_descriptor(
ptrdiff_t
local_n0
,
local_0_start
;
for
(
int
i
=
0
;
i
<
this
->
ndims
;
i
++
)
nfftw
[
i
]
=
n
[
i
];
this
->
local_size
=
fftw_mpi_local_size_many
(
this
->
local_size
=
fftw_
interface
<
rnumber
>::
mpi_local_size_many
(
this
->
ndims
,
&
nfftw
.
front
(),
1
,
...
...
bfps/cpp/fluid_solver.cpp
View file @
ecb66486
...
...
@@ -86,10 +86,10 @@ fluid_solver<rnumber>::fluid_solver(
this
->
rv
[
1
]
=
fftw_interface
<
rnumber
>::
alloc_real
(
this
->
cd
->
local_size
*
2
);
this
->
rv
[
2
]
=
this
->
rv
[
1
];
this
->
c2r_vorticity
=
new
typename
fftw_interface
<
rnumber
>::
plan
;
this
->
r2c_vorticity
=
new
typename
fftw_interface
<
rnumber
>::
plan
;
this
->
c2r_velocity
=
new
typename
fftw_interface
<
rnumber
>::
plan
;
this
->
r2c_velocity
=
new
typename
fftw_interface
<
rnumber
>::
plan
;
this
->
c2r_vorticity
=
new
typename
fftw_interface
<
rnumber
>::
many_
plan
;
this
->
r2c_vorticity
=
new
typename
fftw_interface
<
rnumber
>::
many_
plan
;
this
->
c2r_velocity
=
new
typename
fftw_interface
<
rnumber
>::
many_
plan
;
this
->
r2c_velocity
=
new
typename
fftw_interface
<
rnumber
>::
many_
plan
;
ptrdiff_t
sizes
[]
=
{
nz
,
ny
,
...
...
@@ -120,10 +120,10 @@ fluid_solver<rnumber>::fluid_solver(
this
->
vc2r
[
0
]
=
this
->
c2r_vorticity
;
this
->
vr2c
[
0
]
=
this
->
r2c_vorticity
;
this
->
vc2r
[
1
]
=
new
typename
fftw_interface
<
rnumber
>::
plan
;
this
->
vr2c
[
1
]
=
new
typename
fftw_interface
<
rnumber
>::
plan
;
this
->
vc2r
[
2
]
=
new
typename
fftw_interface
<
rnumber
>::
plan
;
this
->
vr2c
[
2
]
=
new
typename
fftw_interface
<
rnumber
>::
plan
;
this
->
vc2r
[
1
]
=
new
typename
fftw_interface
<
rnumber
>::
many_
plan
;
this
->
vr2c
[
1
]
=
new
typename
fftw_interface
<
rnumber
>::
many_
plan
;
this
->
vc2r
[
2
]
=
new
typename
fftw_interface
<
rnumber
>::
many_
plan
;
this
->
vr2c
[
2
]
=
new
typename
fftw_interface
<
rnumber
>::
many_
plan
;
*
(
this
->
vc2r
[
1
])
=
fftw_interface
<
rnumber
>::
mpi_plan_many_dft_c2r
(
3
,
sizes
,
3
,
FFTW_MPI_DEFAULT_BLOCK
,
FFTW_MPI_DEFAULT_BLOCK
,
...
...
bfps/cpp/fluid_solver.hpp
View file @
ecb66486
...
...
@@ -55,12 +55,12 @@ class fluid_solver:public fluid_solver_base<rnumber>
typename
fluid_solver_base
<
rnumber
>::
cnumber
*
cu
,
*
cv
[
4
];
/* plans */
typename
fftw_interface
<
rnumber
>::
plan
*
c2r_vorticity
;
typename
fftw_interface
<
rnumber
>::
plan
*
r2c_vorticity
;
typename
fftw_interface
<
rnumber
>::
plan
*
c2r_velocity
;
typename
fftw_interface
<
rnumber
>::
plan
*
r2c_velocity
;
typename
fftw_interface
<
rnumber
>::
plan
*
uc2r
,
*
ur2c
;
typename
fftw_interface
<
rnumber
>::
plan
*
vr2c
[
3
],
*
vc2r
[
3
];
typename
fftw_interface
<
rnumber
>::
many_
plan
*
c2r_vorticity
;
typename
fftw_interface
<
rnumber
>::
many_
plan
*
r2c_vorticity
;
typename
fftw_interface
<
rnumber
>::
many_
plan
*
c2r_velocity
;
typename
fftw_interface
<
rnumber
>::
many_
plan
*
r2c_velocity
;
typename
fftw_interface
<
rnumber
>::
many_
plan
*
uc2r
,
*
ur2c
;
typename
fftw_interface
<
rnumber
>::
many_
plan
*
vr2c
[
3
],
*
vc2r
[
3
];
/* physical parameters */
double
nu
;
...
...
bfps/cpp/fluid_solver_base.cpp
View file @
ecb66486
...
...
@@ -52,7 +52,7 @@ void fluid_solver_base<rnumber>::clean_up_real_space(rnumber *a, int howmany)
template
<
class
rnumber
>
double
fluid_solver_base
<
rnumber
>::
autocorrel
(
cnumber
*
a
)
{
double
*
spec
=
fftw_alloc_real
(
this
->
nshells
*
9
);
double
*
spec
=
fftw_
interface
<
double
>::
alloc_real
(
this
->
nshells
*
9
);
double
sum_local
;
this
->
cospectrum
(
a
,
a
,
spec
);
sum_local
=
0.0
;
...
...
@@ -60,7 +60,7 @@ double fluid_solver_base<rnumber>::autocorrel(cnumber *a)
{
sum_local
+=
spec
[
n
*
9
]
+
spec
[
n
*
9
+
4
]
+
spec
[
n
*
9
+
8
];
}
fftw_free
(
spec
);
fftw_
interface
<
double
>::
free
(
spec
);
return
sum_local
;
}
...
...
@@ -427,7 +427,7 @@ template <class rnumber>
void
fluid_solver_base
<
rnumber
>::
write_spectrum
(
const
char
*
fname
,
cnumber
*
a
,
const
double
k2exponent
)
{
TIMEZONE
(
"fluid_solver_base::write_spectrum"
);
double
*
spec
=
fftw_alloc_real
(
this
->
nshells
);
double
*
spec
=
fftw_
interface
<
double
>::
alloc_real
(
this
->
nshells
);
this
->
cospectrum
(
a
,
a
,
spec
,
k2exponent
);
if
(
this
->
cd
->
myrank
==
0
)
{
...
...
@@ -439,7 +439,7 @@ void fluid_solver_base<rnumber>::write_spectrum(const char *fname, cnumber *a, c
fwrite
((
void
*
)
spec
,
sizeof
(
double
),
this
->
nshells
,
spec_file
);
fclose
(
spec_file
);
}
fftw_free
(
spec
);
fftw_
interface
<
double
>::
free
(
spec
);
}
/*****************************************************************************/
...
...
bfps/cpp/slab_field_particles.cpp
View file @
ecb66486
...
...
@@ -69,11 +69,11 @@ slab_field_particles<rnumber>::slab_field_particles(
this
->
buffer_width
=
this
->
interp_neighbours
+
1
;
this
->
buffer_size
=
this
->
buffer_width
*
this
->
fs
->
rd
->
slice_size
;
this
->
array_size
=
this
->
nparticles
*
this
->
ncomponents
;
this
->
state
=
fftw_alloc_real
(
this
->
array_size
);
this
->
state
=
fftw_
interface
<
rnumber
>::
alloc_real
(
this
->
array_size
);
std
::
fill_n
(
this
->
state
,
this
->
array_size
,
0.0
);
for
(
int
i
=
0
;
i
<
this
->
integration_steps
;
i
++
)
{
this
->
rhs
[
i
]
=
fftw_alloc_real
(
this
->
array_size
);
this
->
rhs
[
i
]
=
fftw_
interface
<
rnumber
>::
alloc_real
(
this
->
array_size
);
std
::
fill_n
(
this
->
rhs
[
i
],
this
->
array_size
,
0.0
);
}
this
->
watching
=
new
bool
[
this
->
fs
->
rd
->
nprocs
*
nparticles
];
...
...
@@ -131,10 +131,10 @@ slab_field_particles<rnumber>::~slab_field_particles()
{
delete
[]
this
->
computing
;
delete
[]
this
->
watching
;
fftw_free
(
this
->
state
);
fftw_
interface
<
rnumber
>::
free
(
this
->
state
);
for
(
int
i
=
0
;
i
<
this
->
integration_steps
;
i
++
)
{
fftw_free
(
this
->
rhs
[
i
]);
fftw_
interface
<
rnumber
>::
free
(
this
->
rhs
[
i
]);
}
delete
[]
this
->
lbound
;
delete
[]
this
->
ubound
;
...
...
@@ -193,7 +193,7 @@ void slab_field_particles<rnumber>::synchronize_single_particle_state(int p, dou
template
<
class
rnumber
>
void
slab_field_particles
<
rnumber
>::
synchronize
()
{
double
*
tstate
=
fftw_alloc_real
(
this
->
array_size
);
double
*
tstate
=
fftw_
interface
<
double
>::
alloc_real
(
this
->
array_size
);
// first, synchronize state and jump across CPUs
std
::
fill_n
(
tstate
,
this
->
array_size
,
0.0
);
for
(
int
p
=
0
;
p
<
this
->
nparticles
;
p
++
)
...
...
@@ -236,14 +236,14 @@ void slab_field_particles<rnumber>::synchronize()
this
->
fs
->
rd
->
comm
);
}
}
fftw_free
(
tstate
);
fftw_
interface
<
double
>::
free
(
tstate
);
// assignment of particles
for
(
int
p
=
0
;
p
<
this
->
nparticles
;
p
++
)
{
this
->
computing
[
p
]
=
this
->
get_rank
(
this
->
state
[
p
*
this
->
ncomponents
+
2
]);
//DEBUG_MSG("synchronizing particles, particle %d computing is %d\n", p, this->computing[p]);
}
double
*
jump
=
fftw_alloc_real
(
this
->
nparticles
);
double
*
jump
=
fftw_
interface
<
double
>::
alloc_real
(
this
->
nparticles
);
this
->
jump_estimate
(
jump
);
// now, see who needs to watch
bool
*
local_watching
=
new
bool
[
this
->
fs
->
rd
->
nprocs
*
this
->
nparticles
];
...
...
@@ -255,7 +255,7 @@ void slab_field_particles<rnumber>::synchronize()
local_watching
[
this
->
get_rank
(
this
->
state
[
this
->
ncomponents
*
p
+
2
]
-
jump
[
p
])
*
this
->
nparticles
+
p
]
=
true
;
local_watching
[
this
->
get_rank
(
this
->
state
[
this
->
ncomponents
*
p
+
2
]
+
jump
[
p
])
*
this
->
nparticles
+
p
]
=
true
;
}
fftw_free
(
jump
);
fftw_
interface
<
double
>::
free
(
jump
);
MPI_Allreduce
(
local_watching
,
this
->
watching
,
...
...
@@ -389,7 +389,7 @@ void slab_field_particles<rnumber>::step()
template
<
class
rnumber
>
void
slab_field_particles
<
rnumber
>::
Euler
()
{
double
*
y
=
fftw_alloc_real
(
this
->
array_size
);
double
*
y
=
fftw_
interface
<
double
>::
alloc_real
(
this
->
array_size
);
this
->
get_rhs
(
this
->
state
,
y
);
for
(
int
p
=
0
;
p
<
this
->
nparticles
;
p
++
)
if
(
this
->
fs
->
rd
->
myrank
==
this
->
computing
[
p
])
{
...
...
@@ -399,7 +399,7 @@ void slab_field_particles<rnumber>::Euler()
// "particle %d state is %lg %lg %lg\n",
// p, this->state[p*this->ncomponents], this->state[p*this->ncomponents+1], this->state[p*this->ncomponents+2]);
}
fftw_free
(
y
);
fftw_
interface
<
double
>::
free
(
y
);
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment