From fc83ed776c052e746ea524b1277a3c23ad40cefc Mon Sep 17 00:00:00 2001 From: Hans Ekkehard Plesser Date: Tue, 5 Mar 2024 09:30:45 +0100 Subject: [PATCH] Fix warning issued by gcc 12.3 --- nestkernel/mpi_manager.cpp | 12 ++++++------ nestkernel/vp_manager.h | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nestkernel/mpi_manager.cpp b/nestkernel/mpi_manager.cpp index 591aecb17f..3492e33c20 100644 --- a/nestkernel/mpi_manager.cpp +++ b/nestkernel/mpi_manager.cpp @@ -400,7 +400,7 @@ nest::MPIManager::communicate_Allgather( std::vector< unsigned int >& send_buffe int disp = 0; unsigned int max_recv_count = send_buffer_size_; bool overflow = false; - for ( int pid = 0; pid < get_num_processes(); ++pid ) + for ( size_t pid = 0; pid < get_num_processes(); ++pid ) { unsigned int block_disp = pid * send_buffer_size_; displacements[ pid ] = disp; @@ -470,7 +470,7 @@ nest::MPIManager::communicate_Allgather( std::vector< T >& send_buffer, int disp = 0; unsigned int max_recv_count = send_buffer_size_; bool overflow = false; - for ( int pid = 0; pid < get_num_processes(); ++pid ) + for ( size_t pid = 0; pid < get_num_processes(); ++pid ) { unsigned int block_disp = pid * send_buffer_size_; displacements[ pid ] = disp; @@ -560,7 +560,7 @@ nest::MPIManager::communicate_Allgather( std::vector< OffGridSpike >& send_buffe int disp = 0; unsigned int max_recv_count = send_buffer_size_; bool overflow = false; - for ( int pid = 0; pid < get_num_processes(); ++pid ) + for ( size_t pid = 0; pid < get_num_processes(); ++pid ) { unsigned int block_disp = pid * send_buffer_size_; displacements[ pid ] = disp; @@ -604,7 +604,7 @@ nest::MPIManager::communicate( std::vector< double >& send_buffer, communicate( n_nodes ); // Set up displacements vector. displacements.resize( get_num_processes(), 0 ); - for ( int i = 1; i < get_num_processes(); ++i ) + for ( size_t i = 1; i < get_num_processes(); ++i ) { displacements.at( i ) = displacements.at( i - 1 ) + n_nodes.at( i - 1 ); } @@ -864,7 +864,7 @@ nest::MPIManager::time_communicatev( int num_bytes, int samples ) std::vector< int > n_nodes( get_num_processes(), packet_length ); std::vector< int > displacements( get_num_processes(), 0 ); - for ( int i = 1; i < get_num_processes(); ++i ) + for ( size_t i = 1; i < get_num_processes(); ++i ) { displacements.at( i ) = displacements.at( i - 1 ) + n_nodes.at( i - 1 ); } @@ -963,7 +963,7 @@ nest::MPIManager::time_communicate_alltoallv( int num_bytes, int samples ) std::vector< int > n_nodes( get_num_processes(), packet_length ); std::vector< int > displacements( get_num_processes(), 0 ); - for ( int i = 1; i < get_num_processes(); ++i ) + for ( size_t i = 1; i < get_num_processes(); ++i ) { displacements.at( i ) = displacements.at( i - 1 ) + n_nodes.at( i - 1 ); } diff --git a/nestkernel/vp_manager.h b/nestkernel/vp_manager.h index 226c389adf..c0acc819a0 100644 --- a/nestkernel/vp_manager.h +++ b/nestkernel/vp_manager.h @@ -203,7 +203,8 @@ inline void nest::VPManager::assert_thread_parallel() const { #ifdef _OPENMP - assert( omp_get_num_threads() == n_threads_ ); + // omp_get_num_threads() returns int + assert( omp_get_num_threads() == static_cast< int >( n_threads_ ) ); #endif }