Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions coreneuron/apps/main1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ char* prepare_args(int& argc, char**& argv, int use_mpi, const char* arg) {
}

int corenrn_embedded_run(int nthread, int have_gaps, int use_mpi, int use_fast_imem, const char* arg) {
corenrn_embedded = 1;
corenrn_embedded = true;
corenrn_embedded_nthread = nthread;
coreneuron::nrn_have_gaps = have_gaps;
if (use_fast_imem) {
coreneuron::nrn_have_gaps = have_gaps != 0;
if (use_fast_imem != 0) {
coreneuron::nrn_use_fast_imem = true;
}

Expand All @@ -143,7 +143,7 @@ int corenrn_embedded_run(int nthread, int have_gaps, int use_mpi, int use_fast_i
free(new_arg);
delete[] argv;

return corenrn_embedded;
return corenrn_embedded ? 1 : 0;
}
}

Expand Down Expand Up @@ -249,23 +249,23 @@ void nrn_init_and_load_data(int argc,
report_mem_usage("Before nrn_setup");

// set if need to interleave cells
use_interleave_permute = corenrn_param.cell_interleave_permute;
interleave_permute_type = corenrn_param.cell_interleave_permute;
cellorder_nwarp = corenrn_param.nwarp;
use_solve_interleave = corenrn_param.cell_interleave_permute;

#if LAYOUT == 1
// permuting not allowed for AoS
use_interleave_permute = 0;
use_solve_interleave = 0;
interleave_permute_type = 0;
use_solve_interleave = false;
#endif

if (corenrn_param.gpu && use_interleave_permute == 0) {
if (corenrn_param.gpu && interleave_permute_type == 0) {
if (nrnmpi_myid == 0) {
printf(
" WARNING : GPU execution requires --cell-permute type 1 or 2. Setting it to 1.\n");
}
use_interleave_permute = 1;
use_solve_interleave = 1;
interleave_permute_type = 1;
use_solve_interleave = true;
}

// pass by flag so existing tests do not need a changed nrn_setup prototype.
Expand Down
4 changes: 2 additions & 2 deletions coreneuron/gpu/nrn_acc_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void setup_nrnthreads_on_device(NrnThread* threads, int nthreads) {
}

if (nt->_permute) {
if (use_interleave_permute == 1) {
if (interleave_permute_type == 1) {
/* todo: not necessary to setup pointers, just copy it */
InterleaveInfo* info = interleave_info + i;
InterleaveInfo* d_info = (InterleaveInfo*)acc_copyin(info, sizeof(InterleaveInfo));
Expand All @@ -347,7 +347,7 @@ void setup_nrnthreads_on_device(NrnThread* threads, int nthreads) {
d_ptr = (int*)acc_copyin(info->cellsize, sizeof(int) * nt->ncell);
acc_memcpy_to_device(&(d_info->cellsize), &d_ptr, sizeof(int*));

} else if (use_interleave_permute == 2) {
} else if (interleave_permute_type == 2) {
/* todo: not necessary to setup pointers, just copy it */
InterleaveInfo* info = interleave_info + i;
InterleaveInfo* d_info = (InterleaveInfo*)acc_copyin(info, sizeof(InterleaveInfo));
Expand Down
12 changes: 6 additions & 6 deletions coreneuron/io/mk_mech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ int nrn_nobanner_;
// NB: this should go away
extern const char* nrn_version(int);

int nrn_need_byteswap;
bool nrn_need_byteswap;
// following copied (except for nrn_need_byteswap line) from NEURON ivocvect.cpp
#define BYTEHEADER \
uint32_t _II__; \
char* _IN__; \
char _OUT__[16]; \
int BYTESWAP_FLAG = 0;
bool BYTESWAP_FLAG = false;
#define BYTESWAP(_X__, _TYPE__) \
BYTESWAP_FLAG = nrn_need_byteswap; \
if (BYTESWAP_FLAG == 1) { \
if (BYTESWAP_FLAG) { \
_IN__ = (char*)&(_X__); \
for (_II__ = 0; _II__ < sizeof(_TYPE__); _II__++) { \
_OUT__[_II__] = _IN__[sizeof(_TYPE__) - _II__ - 1]; \
Expand Down Expand Up @@ -111,10 +111,10 @@ void mk_mech(const char* datpath) {
// binary info in files needs to be byteswapped.
int32_t x;
nrn_assert(fread(&x, sizeof(int32_t), 1, f) == 1);
nrn_need_byteswap = 0;
nrn_need_byteswap = false;
if (x != 1) {
BYTEHEADER;
nrn_need_byteswap = 1;
nrn_need_byteswap = true;
BYTESWAP(x, int32_t);
nrn_assert(x == 1);
}
Expand All @@ -128,7 +128,7 @@ static void mk_mech() {
if (already_called) {
return;
}
nrn_need_byteswap = 0;
nrn_need_byteswap = false;
std::stringstream ss;
nrn_assert(nrn2core_mkmech_info_);
(*nrn2core_mkmech_info_)(ss);
Expand Down
2 changes: 1 addition & 1 deletion coreneuron/io/nrn2core_direct.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern "C" {
// The callbacks into nrn/src/nrniv/nrnbbcore_write.cpp to get
// data directly instead of via files.

extern int corenrn_embedded;
extern bool corenrn_embedded;
extern int corenrn_embedded_nthread;

extern void (*nrn2core_group_ids_)(int*);
Expand Down
6 changes: 3 additions & 3 deletions coreneuron/io/nrn_checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ THE POSSIBILITY OF SUCH DAMAGE.

namespace coreneuron {
bool nrn_checkpoint_arg_exists;
int _nrn_skip_initmodel;
bool _nrn_skip_initmodel;
} // namespace coreneuron
#define UseFileHandlerWrap 0

Expand Down Expand Up @@ -868,7 +868,7 @@ bool checkpoint_initialize() {

// in case some nrn_init allocate data we need to do that but do not
// want to call initmodel.
_nrn_skip_initmodel = 1;
_nrn_skip_initmodel = true;
for (int i = 0; i < nrn_nthread; ++i) { // should be parallel
NrnThread& nt = nrn_threads[i];
for (NrnThreadMembList* tml = nt.tml; tml; tml = tml->next) {
Expand All @@ -879,7 +879,7 @@ bool checkpoint_initialize() {
}
}
}
_nrn_skip_initmodel = 0;
_nrn_skip_initmodel = false;

// if PatternStim exists, needs initialization
for (NrnThreadMembList* tml = nrn_threads[0].tml; tml; tml = tml->next) {
Expand Down
18 changes: 9 additions & 9 deletions coreneuron/io/nrn_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ THE POSSIBILITY OF SUCH DAMAGE.


/// --> Coreneuron
int corenrn_embedded;
bool corenrn_embedded;
int corenrn_embedded_nthread;

void (*nrn2core_group_ids_)(int*);
Expand Down Expand Up @@ -291,14 +291,14 @@ static void store_phase_args(int ngroup,
FileHandler* file_reader,
const char* path,
const char* restore_path,
int byte_swap) {
bool byte_swap) {
ngroup_w = ngroup;
gidgroups_w = gidgroups;
imult_w = imult;
file_reader_w = file_reader;
path_w = path;
restore_path_w = restore_path;
byte_swap_w = (bool)byte_swap;
byte_swap_w = byte_swap;
}

/* read files.dat file and distribute cellgroups to all mpi ranks */
Expand Down Expand Up @@ -333,7 +333,7 @@ void nrn_read_filesdat(int& ngrp, int*& grp, int multiple, int*& imult, const ch
// being backward compatible
if (iNumFiles == -1) {
nrn_assert(fscanf(fp, "%d\n", &iNumFiles) == 1);
nrn_have_gaps = 1;
nrn_have_gaps = true;
if (nrnmpi_myid == 0) {
printf("Model uses gap junctions\n");
}
Expand Down Expand Up @@ -672,7 +672,7 @@ void nrn_setup_cleanup() {

void nrn_setup(const char* filesdat,
bool is_mapping_needed,
int byte_swap,
bool byte_swap,
bool run_setup_cleanup,
const char* datpath,
const char* restore_path,
Expand Down Expand Up @@ -1189,7 +1189,7 @@ void delete_trajectory_requests(NrnThread& nt) {
}

void read_phase2(FileHandler& F, int imult, NrnThread& nt) {
bool direct = corenrn_embedded ? true : false;
bool direct = corenrn_embedded;
if (!direct) {
assert(!F.fail()); // actually should assert that it is open
}
Expand Down Expand Up @@ -1497,7 +1497,7 @@ void read_phase2(FileHandler& F, int imult, NrnThread& nt) {
}
}

if (nrn_have_gaps == 1) {
if (nrn_have_gaps) {
nrn_partrans::gap_thread_setup(nt);
}

Expand Down Expand Up @@ -1581,7 +1581,7 @@ void read_phase2(FileHandler& F, int imult, NrnThread& nt) {
vectors will be read and will need to be permuted as well in subsequent
sections of this function.
*/
if (use_interleave_permute) {
if (interleave_permute_type) {
nt._permute = interleave_order(nt.id, nt.ncell, nt.end, nt._v_parent_index);
}
if (nt._permute) {
Expand Down Expand Up @@ -1628,7 +1628,7 @@ for (int i=0; i < nt.end; ++i) {
}
}

if (nrn_have_gaps == 1 && use_interleave_permute) {
if (nrn_have_gaps && interleave_permute_type) {
nrn_partrans::gap_indices_permute(nt);
}

Expand Down
6 changes: 3 additions & 3 deletions coreneuron/mpi/nrnmpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extern void nrnmpi_checkbufleak();
static int nrnmpi_under_nrncontrol_;

void nrnmpi_init(int nrnmpi_under_nrncontrol, int* pargc, char*** pargv) {
nrnmpi_use = 1;
nrnmpi_use = true;
nrnmpi_under_nrncontrol_ = nrnmpi_under_nrncontrol;
if (nrnmpi_under_nrncontrol_) {
#if !ALWAYS_CALL_MPI_INIT
Expand All @@ -87,7 +87,7 @@ void nrnmpi_init(int nrnmpi_under_nrncontrol, int* pargc, char*** pargv) {
b = true;
}
if (!b) {
nrnmpi_use = 0;
nrnmpi_use = false;
nrnmpi_under_nrncontrol_ = 0;
return;
}
Expand Down Expand Up @@ -153,7 +153,7 @@ void nrnmpi_terminate() {
if (nrnmpi_under_nrncontrol_) {
MPI_Finalize();
}
nrnmpi_use = 0;
nrnmpi_use = false;
#if nrnmpidebugleak
nrnmpi_checkbufleak();
#endif
Expand Down
2 changes: 1 addition & 1 deletion coreneuron/mpi/nrnmpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef struct {
double spiketime;
} NRNMPI_Spike;

extern int nrnmpi_use; /* NEURON does MPI init and terminate?*/
extern bool nrnmpi_use; /* NEURON does MPI init and terminate?*/

} // namespace coreneuron
#include "coreneuron/mpi/nrnmpidec.h"
Expand Down
2 changes: 1 addition & 1 deletion coreneuron/mpi/nrnmpi_def_cinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
*/

namespace coreneuron {
int nrnmpi_use;
bool nrnmpi_use;
int nrnmpi_numprocs = 1; /* size */
int nrnmpi_myid = 0; /* rank */
int nrnmpi_numprocs_world = 1;
Expand Down
10 changes: 5 additions & 5 deletions coreneuron/network/multisend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ of spikes sent is equal to the number of spikes sent.
// which has the greatest amount of overlap between computation
// and communication.
namespace coreneuron {
int use_multisend_;
int use_phase2_;
bool use_multisend_;
bool use_phase2_;
int n_multisend_interval = 2;

#if NRN_MULTISEND
Expand Down Expand Up @@ -352,7 +352,7 @@ static int multisend_advance() {

#if NRN_MULTISEND
void nrn_multisend_advance() {
if (use_multisend_ == 1) {
if (use_multisend_) {
multisend_advance();
#if ENQUEUE == 2
multisend_receive_buffer[current_rbuf]->enqueue();
Expand All @@ -373,7 +373,7 @@ void nrn_multisend_receive(NrnThread* nt) {
#endif
// w1 = nrn_wtime();
#if NRN_MULTISEND & 1
if (use_multisend_ == 1) {
if (use_multisend_) {
nrn_multisend_advance();
#if 0 && ENQUEUE == 2
// want the overlap with computation, not conserve
Expand Down Expand Up @@ -437,7 +437,7 @@ void nrn_multisend_cleanup() {

void nrn_multisend_setup() {
nrn_multisend_cleanup();
if (use_multisend_ == 0) {
if (!use_multisend_) {
return;
}
nrnmpi_multisend_comm();
Expand Down
6 changes: 3 additions & 3 deletions coreneuron/network/multisend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#include "coreneuron/mpi/nrnmpiuse.h"
namespace coreneuron {
extern int use_multisend_;
extern bool use_multisend_;
extern int n_multisend_interval;
extern int use_phase2_;
extern bool use_phase2_;

class PreSyn;
class NrnThread;
Expand All @@ -18,6 +18,6 @@ void nrn_multisend_init();
void nrn_multisend_cleanup();
void nrn_multisend_setup();

void nrn_multisend_setup_targets(int use_phase2, int*& targets_phase1, int*& targets_phase2);
void nrn_multisend_setup_targets(bool use_phase2, int*& targets_phase1, int*& targets_phase2);
} // namespace coreneuron
#endif // nrnmultisend_h
2 changes: 1 addition & 1 deletion coreneuron/network/multisend_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ to not use any PreSyn information.
static int setup_target_lists(int, int**);
static void fill_multisend_lists(int, int, int*, int*&, int*&);

void nrn_multisend_setup_targets(int use_phase2, int*& targets_phase1, int*& targets_phase2) {
void nrn_multisend_setup_targets(bool use_phase2, int*& targets_phase1, int*& targets_phase2) {
int* r;
int sz = setup_target_lists(use_phase2, &r);

Expand Down
2 changes: 1 addition & 1 deletion coreneuron/network/netcvode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ typedef void (*ReceiveFunc)(Point_process*, double*, double);

double NetCvode::eps_;
NetCvode* net_cvode_instance;
int cvode_active_;
bool cvode_active_;

/// Flag to use the bin queue
bool nrn_use_bin_queue_ = 0;
Expand Down
2 changes: 1 addition & 1 deletion coreneuron/network/partrans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// assert that every HalfGap instance in the thread have been a
// ParallelContext.target(&HalfGap.vpre, sid)
namespace coreneuron {
int nrn_have_gaps;
bool nrn_have_gaps;

using namespace nrn_partrans;

Expand Down
2 changes: 1 addition & 1 deletion coreneuron/network/partrans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace coreneuron {
struct Memb_list;

extern int nrn_have_gaps;
extern bool nrn_have_gaps;
extern void nrnmpi_v_transfer();
extern void nrnthread_v_transfer(NrnThread*);

Expand Down
2 changes: 1 addition & 1 deletion coreneuron/nrnconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ extern double celsius;
extern double t, dt;
extern int rev_dt;
extern int secondorder;
extern int stoprun;
extern bool stoprun;
extern const char* bbcore_write_version;
#define tstopbit (1 << 15)
#define tstopset stoprun |= tstopbit
Expand Down
Loading