Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
92dadd3b
There was a problem fetching the pipeline summary.
Commit
92dadd3b
authored
7 years ago
by
Berenger Bramas
Browse files
Options
Downloads
Patches
Plain Diff
Update to ensure no allocation with 0 value in abstract output
parent
481a716a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!23
WIP: Feature/use cmake
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bfps/cpp/full_code/test_interpolation.cpp
+15
-5
15 additions, 5 deletions
bfps/cpp/full_code/test_interpolation.cpp
bfps/cpp/particles/abstract_particles_output.hpp
+25
-22
25 additions, 22 deletions
bfps/cpp/particles/abstract_particles_output.hpp
with
40 additions
and
27 deletions
bfps/cpp/full_code/test_interpolation.cpp
+
15
−
5
View file @
92dadd3b
...
@@ -131,8 +131,12 @@ int test_interpolation<rnumber>::do_work()
...
@@ -131,8 +131,12 @@ int test_interpolation<rnumber>::do_work()
this
->
nabla_u
->
rval
(
741
,
1
,
2
)
-
this
->
nabla_u
->
rval
(
741
,
2
,
1
));
this
->
nabla_u
->
rval
(
741
,
1
,
2
)
-
this
->
nabla_u
->
rval
(
741
,
2
,
1
));
// allocate interpolation arrays
// allocate interpolation arrays
std
::
unique_ptr
<
double
[]
>
p3data
(
new
double
[
3
*
this
->
ps
->
getLocalNbParticles
()]);
std
::
unique_ptr
<
double
[]
>
p3data
;
std
::
unique_ptr
<
double
[]
>
p9data
(
new
double
[
9
*
this
->
ps
->
getLocalNbParticles
()]);
std
::
unique_ptr
<
double
[]
>
p9data
;
if
(
this
->
ps
->
getLocalNbParticles
()){
p3data
.
reset
(
new
double
[
3
*
this
->
ps
->
getLocalNbParticles
()]);
p9data
.
reset
(
new
double
[
9
*
this
->
ps
->
getLocalNbParticles
()]);
}
/// sample position
/// sample position
std
::
copy
(
this
->
ps
->
getParticlesState
(),
std
::
copy
(
this
->
ps
->
getParticlesState
(),
...
@@ -150,7 +154,9 @@ int test_interpolation<rnumber>::do_work()
...
@@ -150,7 +154,9 @@ int test_interpolation<rnumber>::do_work()
/// sample velocity at particles' position
/// sample velocity at particles' position
std
::
fill_n
(
p3data
.
get
(),
3
*
this
->
ps
->
getLocalNbParticles
(),
0
);
std
::
fill_n
(
p3data
.
get
(),
3
*
this
->
ps
->
getLocalNbParticles
(),
0
);
this
->
ps
->
sample_compute_field
(
*
this
->
velocity
,
p3data
.
get
());
this
->
ps
->
sample_compute_field
(
*
this
->
velocity
,
p3data
.
get
());
DEBUG_MSG
(
"first vel value is %g
\n
"
,
p3data
.
get
()[
0
]);
if
(
p3data
){
DEBUG_MSG
(
"first vel value is %g
\n
"
,
p3data
.
get
()[
0
]);
}
this
->
particles_sample_writer_mpi
->
template
save_dataset
<
3
>(
this
->
particles_sample_writer_mpi
->
template
save_dataset
<
3
>(
"tracers0"
,
"tracers0"
,
"velocity"
,
"velocity"
,
...
@@ -162,7 +168,9 @@ int test_interpolation<rnumber>::do_work()
...
@@ -162,7 +168,9 @@ int test_interpolation<rnumber>::do_work()
/// sample vorticity at particles' position
/// sample vorticity at particles' position
std
::
fill_n
(
p3data
.
get
(),
3
*
this
->
ps
->
getLocalNbParticles
(),
0
);
std
::
fill_n
(
p3data
.
get
(),
3
*
this
->
ps
->
getLocalNbParticles
(),
0
);
this
->
ps
->
sample_compute_field
(
*
this
->
vorticity
,
p3data
.
get
());
this
->
ps
->
sample_compute_field
(
*
this
->
vorticity
,
p3data
.
get
());
DEBUG_MSG
(
"first vort value is %g
\n
"
,
p3data
.
get
()[
0
]);
if
(
p3data
){
DEBUG_MSG
(
"first vort value is %g
\n
"
,
p3data
.
get
()[
0
]);
}
this
->
particles_sample_writer_mpi
->
template
save_dataset
<
3
>(
this
->
particles_sample_writer_mpi
->
template
save_dataset
<
3
>(
"tracers0"
,
"tracers0"
,
"vorticity"
,
"vorticity"
,
...
@@ -174,7 +182,9 @@ int test_interpolation<rnumber>::do_work()
...
@@ -174,7 +182,9 @@ int test_interpolation<rnumber>::do_work()
/// sample velocity gradient at particles' position
/// sample velocity gradient at particles' position
std
::
fill_n
(
p9data
.
get
(),
9
*
this
->
ps
->
getLocalNbParticles
(),
0
);
std
::
fill_n
(
p9data
.
get
(),
9
*
this
->
ps
->
getLocalNbParticles
(),
0
);
this
->
ps
->
sample_compute_field
(
*
this
->
nabla_u
,
p9data
.
get
());
this
->
ps
->
sample_compute_field
(
*
this
->
nabla_u
,
p9data
.
get
());
DEBUG_MSG
(
"first vel gradient value is %g
\n
"
,
p9data
.
get
()[
0
]);
if
(
p9data
){
DEBUG_MSG
(
"first vel gradient value is %g
\n
"
,
p9data
.
get
()[
0
]);
}
this
->
particles_sample_writer_mpi
->
template
save_dataset
<
9
>(
this
->
particles_sample_writer_mpi
->
template
save_dataset
<
9
>(
"tracers0"
,
"tracers0"
,
"velocity_gradient"
,
"velocity_gradient"
,
...
...
This diff is collapsed.
Click to expand it.
bfps/cpp/particles/abstract_particles_output.hpp
+
25
−
22
View file @
92dadd3b
...
@@ -67,10 +67,10 @@ public:
...
@@ -67,10 +67,10 @@ public:
abstract_particles_output
(
MPI_Comm
in_mpi_com
,
const
partsize_t
inTotalNbParticles
,
const
int
in_nb_rhs
)
throw
()
abstract_particles_output
(
MPI_Comm
in_mpi_com
,
const
partsize_t
inTotalNbParticles
,
const
int
in_nb_rhs
)
throw
()
:
mpi_com
(
in_mpi_com
),
my_rank
(
-
1
),
nb_processes
(
-
1
),
:
mpi_com
(
in_mpi_com
),
my_rank
(
-
1
),
nb_processes
(
-
1
),
total_nb_particles
(
inTotalNbParticles
),
nb_rhs
(
in_nb_rhs
),
total_nb_particles
(
inTotalNbParticles
),
nb_rhs
(
in_nb_rhs
),
buffer_particles_rhs_send
(
in_nb_rhs
),
size_buffers_send
(
-
1
),
buffer_particles_rhs_send
(
in_nb_rhs
),
size_buffers_send
(
0
),
buffers_size_particle_rhs_send
(
-
1
),
buffers_size_particle_rhs_send
(
0
),
buffer_particles_rhs_recv
(
in_nb_rhs
),
size_buffers_recv
(
-
1
),
buffer_particles_rhs_recv
(
in_nb_rhs
),
size_buffers_recv
(
0
),
buffers_size_particle_rhs_recv
(
-
1
),
buffers_size_particle_rhs_recv
(
0
),
nb_processes_involved
(
0
),
current_is_involved
(
true
),
particles_chunk_per_process
(
0
),
nb_processes_involved
(
0
),
current_is_involved
(
true
),
particles_chunk_per_process
(
0
),
particles_chunk_current_size
(
0
),
particles_chunk_current_offset
(
0
)
{
particles_chunk_current_size
(
0
),
particles_chunk_current_offset
(
0
)
{
...
@@ -139,16 +139,16 @@ public:
...
@@ -139,16 +139,16 @@ public:
void
releaseMemory
(){
void
releaseMemory
(){
buffer_indexes_send
.
release
();
buffer_indexes_send
.
release
();
buffer_particles_positions_send
.
release
();
buffer_particles_positions_send
.
release
();
size_buffers_send
=
-
1
;
size_buffers_send
=
0
;
buffer_indexes_recv
.
release
();
buffer_indexes_recv
.
release
();
buffer_particles_positions_recv
.
release
();
buffer_particles_positions_recv
.
release
();
size_buffers_recv
=
-
1
;
size_buffers_recv
=
0
;
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
buffer_particles_rhs_send
[
idx_rhs
].
release
();
buffer_particles_rhs_send
[
idx_rhs
].
release
();
buffer_particles_rhs_recv
[
idx_rhs
].
release
();
buffer_particles_rhs_recv
[
idx_rhs
].
release
();
}
}
buffers_size_particle_rhs_send
=
-
1
;
buffers_size_particle_rhs_send
=
0
;
buffers_size_particle_rhs_recv
=
-
1
;
buffers_size_particle_rhs_recv
=
0
;
}
}
template
<
int
size_particle_rhs
>
template
<
int
size_particle_rhs
>
...
@@ -164,7 +164,7 @@ public:
...
@@ -164,7 +164,7 @@ public:
{
{
TIMEZONE
(
"sort-to-distribute"
);
TIMEZONE
(
"sort-to-distribute"
);
if
(
size_buffers_send
<
nb_particles
&&
nb_particles
){
if
(
size_buffers_send
<
nb_particles
){
size_buffers_send
=
nb_particles
;
size_buffers_send
=
nb_particles
;
buffer_indexes_send
.
reset
(
new
std
::
pair
<
partsize_t
,
partsize_t
>
[
size_buffers_send
]);
buffer_indexes_send
.
reset
(
new
std
::
pair
<
partsize_t
,
partsize_t
>
[
size_buffers_send
]);
buffer_particles_positions_send
.
reset
(
new
real_number
[
size_buffers_send
*
size_particle_positions
]);
buffer_particles_positions_send
.
reset
(
new
real_number
[
size_buffers_send
*
size_particle_positions
]);
...
@@ -176,10 +176,12 @@ public:
...
@@ -176,10 +176,12 @@ public:
buffer_particles_rhs_send
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_send
*
buffers_size_particle_rhs_send
]);
buffer_particles_rhs_send
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_send
*
buffers_size_particle_rhs_send
]);
}
}
}
}
else
if
(
buffers_size_particle_rhs_send
<
size_particle_rhs
&&
size_particle_rhs
>
0
&&
size_buffers_send
>
0
){
else
if
(
buffers_size_particle_rhs_send
<
size_particle_rhs
){
buffers_size_particle_rhs_send
=
size_particle_rhs
;
buffers_size_particle_rhs_send
=
size_particle_rhs
;
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
if
(
size_buffers_send
>
0
){
buffer_particles_rhs_send
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_send
*
buffers_size_particle_rhs_send
]);
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
buffer_particles_rhs_send
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_send
*
buffers_size_particle_rhs_send
]);
}
}
}
}
}
...
@@ -225,23 +227,23 @@ public:
...
@@ -225,23 +227,23 @@ public:
const
int
nb_to_receive
=
exchanger
.
getTotalToRecv
();
const
int
nb_to_receive
=
exchanger
.
getTotalToRecv
();
assert
(
nb_to_receive
==
particles_chunk_current_size
);
assert
(
nb_to_receive
==
particles_chunk_current_size
);
if
(
size_buffers_recv
<
nb_to_receive
&&
nb_to_receive
){
if
(
size_buffers_recv
<
nb_to_receive
){
size_buffers_recv
=
nb_to_receive
;
size_buffers_recv
=
nb_to_receive
;
buffer_indexes_recv
.
reset
(
new
partsize_t
[
size_buffers_recv
]);
buffer_indexes_recv
.
reset
(
new
partsize_t
[
size_buffers_recv
]);
buffer_particles_positions_recv
.
reset
(
new
real_number
[
size_buffers_recv
*
size_particle_positions
]);
buffer_particles_positions_recv
.
reset
(
new
real_number
[
size_buffers_recv
*
size_particle_positions
]);
if
(
buffers_size_particle_rhs_recv
<
size_particle_rhs
){
buffers_size_particle_rhs_recv
=
size_particle_rhs
;
buffers_size_particle_rhs_recv
=
size_particle_rhs
;
}
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
buffer_particles_rhs_recv
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_recv
*
buffers_size_particle_rhs_recv
]);
buffer_particles_rhs_recv
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_recv
*
buffers_size_particle_rhs_recv
]);
}
}
}
}
else
if
(
buffers_size_particle_rhs_recv
<
size_particle_rhs
&&
size_buffers_recv
>
0
){
else
if
(
buffers_size_particle_rhs_recv
<
size_particle_rhs
){
buffers_size_particle_rhs_recv
=
size_particle_rhs
;
buffers_size_particle_rhs_recv
=
size_particle_rhs
;
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
if
(
size_buffers_recv
>
0
){
buffer_particles_rhs_recv
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_recv
*
buffers_size_particle_rhs_recv
]);
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
}
buffer_particles_rhs_recv
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_recv
*
buffers_size_particle_rhs_recv
]);
}
}
}
}
{
{
...
@@ -260,10 +262,11 @@ public:
...
@@ -260,10 +262,11 @@ public:
return
;
return
;
}
}
if
(
size_buffers_send
<
nb_to_receive
&&
nb_to_receive
){
if
(
size_buffers_send
<
nb_to_receive
){
size_buffers_send
=
nb_to_receive
;
size_buffers_send
=
nb_to_receive
;
buffer_indexes_send
.
reset
(
new
std
::
pair
<
partsize_t
,
partsize_t
>
[
size_buffers_send
]);
buffer_indexes_send
.
reset
(
new
std
::
pair
<
partsize_t
,
partsize_t
>
[
size_buffers_send
]);
buffer_particles_positions_send
.
reset
(
new
real_number
[
size_buffers_send
*
size_particle_positions
]);
buffer_particles_positions_send
.
reset
(
new
real_number
[
size_buffers_send
*
size_particle_positions
]);
buffers_size_particle_rhs_send
=
size_particle_rhs
;
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
for
(
int
idx_rhs
=
0
;
idx_rhs
<
nb_rhs
;
++
idx_rhs
){
buffer_particles_rhs_send
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_send
*
buffers_size_particle_rhs_send
]);
buffer_particles_rhs_send
[
idx_rhs
].
reset
(
new
real_number
[
size_buffers_send
*
buffers_size_particle_rhs_send
]);
}
}
...
...
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