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