Commit 038f9434 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

identify more variables used only in assert

parent a862c190
Pipeline #37028 failed with stage
......@@ -351,6 +351,7 @@ public:
// Offset per cell layers
long int previous_index = 0;
variable_used_only_in_assert(previous_index);
std::unique_ptr<partsize_t[]> particles_offset_layers(new partsize_t[my_nb_cell_levels+1]());
for(int idxPartition = 0 ; idxPartition < current_partition_size ; ++idxPartition){
for(partsize_t idx_part = current_offset_particles_for_partition[idxPartition] ;
......
......@@ -523,6 +523,7 @@ public:
for(int idxPartition = 0 ; idxPartition < current_partition_size ; ++idxPartition){
for(partsize_t idx = 0 ; idx < current_my_nb_particles_per_partition[idxPartition] ; ++idx){
const int partition_level = in_computer.pbc_field_layer((*inout_positions_particles)[(idx+partOffset)*size_particle_positions+IDX_Z], IDX_Z);
variable_used_only_in_assert(partition_level);
assert(partition_level == current_partition_interval.first + idxPartition
|| partition_level == (current_partition_interval.first + idxPartition-1+int(field_grid_dim[IDX_Z]))%int(field_grid_dim[IDX_Z])
|| partition_level == (current_partition_interval.first + idxPartition+1)%int(field_grid_dim[IDX_Z]));
......
......@@ -46,6 +46,7 @@ public:
pos_part[idx0+IDX_X]*pos_part[idx0+IDX_X] +
pos_part[idx0+IDX_Y]*pos_part[idx0+IDX_Y] +
pos_part[idx0+IDX_Z]*pos_part[idx0+IDX_Z]);
variable_used_only_in_assert(orientation_size);
assert(orientation_size > 0.99);
assert(orientation_size < 1.01);
// I call "rotation" to be the right hand side of the orientation part of the ODE
......
......@@ -79,6 +79,7 @@ public:
assert(plist_id_par >= 0);
{
int retTest = H5Pset_fapl_mpio(plist_id_par, mpi_comm, MPI_INFO_NULL);
variable_used_only_in_assert(retTest);
assert(retTest >= 0);
}
......@@ -98,6 +99,7 @@ public:
std::vector<hsize_t> state_dim_array(space_dim);
int hdfret = H5Sget_simple_extent_dims(dspace, &state_dim_array[0], NULL);
variable_used_only_in_assert(hdfret);
assert(hdfret >= 0);
// Last value is the position dim of the particles
assert(state_dim_array.back() == size_particle_positions);
......@@ -126,6 +128,7 @@ public:
// Chichi comment: wouldn't &rhs_dim_array.front() be safer?
int hdfret = H5Sget_simple_extent_dims(dspace, &rhs_dim_array[0], NULL);
variable_used_only_in_assert(hdfret);
assert(hdfret >= 0);
assert(rhs_dim_array.back() == size_particle_rhs);
// Chichi comment: this assertion will fail in general
......@@ -166,6 +169,7 @@ public:
int rethdf = H5Sselect_hyperslab(rspace, H5S_SELECT_SET, offset,
NULL, mem_dims, NULL);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
rethdf = H5Dread(dset, type_id, mspace, rspace, H5P_DEFAULT, split_particles_positions.get());
assert(rethdf >= 0);
......@@ -197,6 +201,7 @@ public:
int rethdf = H5Sselect_hyperslab( rspace, H5S_SELECT_SET, offset,
NULL, mem_dims, NULL);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
rethdf = H5Dread(dset, type_id, mspace, rspace, H5P_DEFAULT, split_particles_rhs[idx_rhs].get());
assert(rethdf >= 0);
......@@ -208,6 +213,7 @@ public:
assert(rethdf >= 0);
}
int rethdf = H5Dclose(dset);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
}
......@@ -285,6 +291,7 @@ public:
{
TIMEZONE("close");
int hdfret = H5Fclose(particle_file);
variable_used_only_in_assert(hdfret);
assert(hdfret >= 0);
hdfret = H5Pclose(plist_id_par);
assert(hdfret >= 0);
......
......@@ -59,6 +59,7 @@ public:
plist_id_par,
Parent::getComWriter(),
MPI_INFO_NULL);
variable_used_only_in_assert(retTest);
assert(retTest >= 0);
// Parallel HDF5 write
......@@ -97,6 +98,7 @@ public:
TIMEZONE("particles_output_hdf5::close_file");
int rethdf = H5Gclose(dset_id_state);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
rethdf = H5Gclose(dset_id_rhs);
......@@ -197,6 +199,7 @@ public:
assert(plist_id >= 0);
{
int rethdf = H5Pset_dxpl_mpio(plist_id, use_collective_io ? H5FD_MPIO_COLLECTIVE : H5FD_MPIO_INDEPENDENT);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
}
......@@ -233,6 +236,7 @@ public:
NULL,
count,
NULL);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
herr_t status = H5Dwrite(
......@@ -242,6 +246,7 @@ public:
filespace,
plist_id,
particles_positions);
variable_used_only_in_assert(status);
assert(status >= 0);
rethdf = H5Sclose(memspace);
assert(rethdf >= 0);
......@@ -289,6 +294,7 @@ public:
NULL,
count,
NULL);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
herr_t status = H5Dwrite(
......@@ -298,6 +304,7 @@ public:
filespace,
plist_id,
particles_rhs[idx_rhs].get());
variable_used_only_in_assert(status);
assert(status >= 0);
rethdf = H5Sclose(filespace);
assert(rethdf >= 0);
......@@ -305,11 +312,13 @@ public:
assert(rethdf >= 0);
}
int rethdf = H5Dclose(dataset_id);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
}
{
int rethdf = H5Pclose(plist_id);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
}
}
......
......@@ -69,6 +69,7 @@ public:
plist_id_par,
Parent::getComWriter(),
MPI_INFO_NULL);
variable_used_only_in_assert(retTest);
assert(retTest >= 0);
// open file for parallel HDF5 access
......@@ -93,6 +94,7 @@ public:
if(Parent::isInvolved()){
// close group
int retTest = H5Gclose(pgroup_id);
variable_used_only_in_assert(retTest);
assert(retTest >= 0);
// close file
retTest = H5Fclose(file_id);
......@@ -106,6 +108,7 @@ public:
if(Parent::isInvolved()){
// close old group
int retTest = H5Gclose(pgroup_id);
variable_used_only_in_assert(retTest);
assert(retTest >= 0);
// open new group
......@@ -131,6 +134,7 @@ public:
// update group
int retTest = this->switch_to_group(
in_groupname);
variable_used_only_in_assert(retTest);
assert(retTest == EXIT_SUCCESS);
// update dataset name
dataset_name = in_dataset_name + "/" + std::to_string(idx_time_step);
......@@ -182,6 +186,7 @@ public:
(use_collective_io ?
H5FD_MPIO_COLLECTIVE :
H5FD_MPIO_INDEPENDENT));
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
}
{
......@@ -219,6 +224,7 @@ public:
NULL,
count,
NULL);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
herr_t status = H5Dwrite(
......@@ -228,6 +234,7 @@ public:
filespace,
plist_id,
particles_rhs[0].get());
variable_used_only_in_assert(status);
assert(status >= 0);
rethdf = H5Sclose(filespace);
assert(rethdf >= 0);
......@@ -239,6 +246,7 @@ public:
{
int rethdf = H5Pclose(plist_id);
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
}
}
......
......@@ -101,6 +101,7 @@ public:
for(partsize_t idx_part = 0 ; idx_part < my_nb_particles ; ++idx_part){ // TODO remove me
const int partition_level = computer.pbc_field_layer(my_particles_positions[idx_part*size_particle_positions+IDX_Z], IDX_Z);
variable_used_only_in_assert(partition_level);
assert(partition_level >= current_partition_interval.first);
assert(partition_level < current_partition_interval.second);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment