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
21 changes: 3 additions & 18 deletions coreneuron/io/nrn_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ void (*nrn2core_all_weights_return_)(std::vector<double*>& weights);
namespace coreneuron {
extern corenrn_parameters corenrn_param;

#ifdef _OPENMP
static OMP_Mutex mut;
#endif

static size_t model_size(void);

Expand Down Expand Up @@ -479,13 +477,7 @@ void nrn_setup(const char* filesdat,
Phase1 p1;
p1.read_direct(n->id);
NrnThread& nt = *n;
{
#ifdef _OPENMP
p1.populate(nt, mut);
#else
p1.populate(nt);
#endif
}
p1.populate(nt, mut);
});
}

Expand Down Expand Up @@ -538,9 +530,7 @@ void setup_ThreadData(NrnThread& nt) {
ml->_thread = (ThreadDatum*)ecalloc_align(mf.thread_size_, sizeof(ThreadDatum));
if (mf.thread_mem_init_) {
{
#ifdef _OPENMP
const std::lock_guard<OMP_Mutex> lock(mut);
#endif
(*mf.thread_mem_init_)(ml->_thread);
}
}
Expand Down Expand Up @@ -860,13 +850,8 @@ void read_phase1(NrnThread& nt, UserParams& userParams) {
Phase1 p1;
p1.read_file(userParams.file_reader[nt.id]);

{ // Protect gid2in, gid2out and neg_gid2out
#ifdef _OPENMP
p1.populate(nt, mut);
#else
p1.populate(nt);
#endif
}
// Protect gid2in, gid2out and neg_gid2out
p1.populate(nt, mut);
}

void read_phase2(NrnThread& nt, UserParams& userParams) {
Expand Down
14 changes: 4 additions & 10 deletions coreneuron/io/output_spikes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,23 @@ namespace coreneuron {
std::vector<double> spikevec_time;
std::vector<int> spikevec_gid;

#ifdef _OPENMP
static MUTDEC
#endif
static OMP_Mutex mut;

void
mk_spikevec_buffer(int sz) {
void mk_spikevec_buffer(int sz) {
try {
spikevec_time.reserve(sz);
spikevec_gid.reserve(sz);
} catch (const std::length_error& le) {
std::cerr << "Lenght error" << le.what() << std::endl;
}
if (!MUTCONSTRUCTED) {
MUTCONSTRUCT(1);
}
}

void spikevec_lock() {
MUTLOCK
mut.lock();
}

void spikevec_unlock() {
MUTUNLOCK
mut.unlock();
}

void local_spikevec_sort(std::vector<double>& isvect,
Expand Down
6 changes: 0 additions & 6 deletions coreneuron/io/phase1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ void Phase1::read_direct(int thread_id) {
delete[] netcon_srcgid;
}

#ifdef _OPENMP
void Phase1::populate(NrnThread& nt, OMP_Mutex& mut) {
#else
void Phase1::populate(NrnThread& nt) {
#endif
nt.n_presyn = this->output_gids.size();
nt.n_netcon = this->netcon_srcgids.size();

Expand All @@ -68,9 +64,7 @@ void Phase1::populate(NrnThread& nt) {
}

{
#ifdef _OPENMP
const std::lock_guard<OMP_Mutex> lock(mut);
#endif
// Note that the negative (type, index)
// coded information goes into the neg_gid2out[tid] hash table.
// See netpar.cpp for the netpar_tid_... function implementations.
Expand Down
4 changes: 0 additions & 4 deletions coreneuron/io/phase1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ class Phase1 {
public:
void read_file(FileHandler& F);
void read_direct(int thread_id);
#ifdef _OPENMP
void populate(NrnThread& nt, OMP_Mutex& mut);
#else
void populate(NrnThread& nt);
#endif

private:
std::vector<int> output_gids;
Expand Down
40 changes: 20 additions & 20 deletions coreneuron/network/netcon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class DiscreteEvent {
virtual ~DiscreteEvent();
virtual void send(double deliverytime, NetCvode*, NrnThread*);
virtual void deliver(double t, NetCvode*, NrnThread*);
virtual int type() {
virtual int type() const {
return DiscreteEventType;
}
virtual bool require_checkpoint() {
Expand All @@ -81,12 +81,12 @@ class NetCon : public DiscreteEvent {

NetCon();
virtual ~NetCon();
virtual void send(double sendtime, NetCvode*, NrnThread*);
virtual void deliver(double, NetCvode* ns, NrnThread*);
virtual int type() {
virtual void send(double sendtime, NetCvode*, NrnThread*) override;
virtual void deliver(double, NetCvode* ns, NrnThread*) override;
virtual int type() const override {
return NetConType;
}
virtual void pr(const char*, double t, NetCvode*);
virtual void pr(const char*, double t, NetCvode*) override;
};

class SelfEvent : public DiscreteEvent {
Expand All @@ -98,12 +98,12 @@ class SelfEvent : public DiscreteEvent {

SelfEvent();
virtual ~SelfEvent();
virtual void deliver(double, NetCvode*, NrnThread*);
virtual int type() {
virtual void deliver(double, NetCvode*, NrnThread*) override;
virtual int type() const override {
return SelfEventType;
}

virtual void pr(const char*, double t, NetCvode*);
virtual void pr(const char*, double t, NetCvode*) override;

private:
void call_net_receive(NetCvode*);
Expand Down Expand Up @@ -138,13 +138,13 @@ class PreSyn : public ConditionEvent {

PreSyn();
virtual ~PreSyn();
virtual void send(double sendtime, NetCvode*, NrnThread*);
virtual void deliver(double, NetCvode*, NrnThread*);
virtual int type() {
virtual void send(double sendtime, NetCvode*, NrnThread*) override;
virtual void deliver(double, NetCvode*, NrnThread*) override;
virtual int type() const override {
return PreSynType;
}

virtual double value(NrnThread*);
virtual double value(NrnThread*) override;
void record(double t);
#if NRN_MULTISEND
int multisend_index_;
Expand All @@ -158,9 +158,9 @@ class InputPreSyn : public DiscreteEvent {

InputPreSyn();
virtual ~InputPreSyn();
virtual void send(double sendtime, NetCvode*, NrnThread*);
virtual void deliver(double, NetCvode*, NrnThread*);
virtual int type() {
virtual void send(double sendtime, NetCvode*, NrnThread*) override;
virtual void deliver(double, NetCvode*, NrnThread*) override;
virtual int type() const override {
return InputPreSynType;
}
#if NRN_MULTISEND
Expand All @@ -174,14 +174,14 @@ class NetParEvent : public DiscreteEvent {
double wx_, ws_; // exchange time and "spikes to Presyn" time

NetParEvent();
virtual ~NetParEvent();
virtual void send(double, NetCvode*, NrnThread*);
virtual void deliver(double, NetCvode*, NrnThread*);
virtual int type() {
virtual ~NetParEvent() = default;
virtual void send(double, NetCvode*, NrnThread*) override;
virtual void deliver(double, NetCvode*, NrnThread*) override;
virtual int type() const override {
return NetParEventType;
}

virtual void pr(const char*, double t, NetCvode*);
virtual void pr(const char*, double t, NetCvode*) override;
};
} // namespace coreneuron
#endif
Loading