Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 7af0c6e

Browse files
Nicolas Cornupramodk
andauthored
Fix warning by returning true in try_lock and remove byteswap1.dat code (#387)
* Fix warning by return true in try_lock * byteswap1.dat is removed from neuron; cleanup unnecessary code from coreneuron Co-authored-by: pramodk <[email protected]>
1 parent 07bf5f1 commit 7af0c6e

File tree

5 files changed

+4
-45
lines changed

5 files changed

+4
-45
lines changed

coreneuron/apps/main1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void nrn_init_and_load_data(int argc,
249249
use_phase2_ = (corenrn_param.ms_phases == 2) ? 1 : 0;
250250

251251
// reading *.dat files and setting up the data structures, setting mindelay
252-
nrn_setup(filesdat.c_str(), is_mapping_needed, nrn_need_byteswap, run_setup_cleanup,
252+
nrn_setup(filesdat.c_str(), is_mapping_needed, run_setup_cleanup,
253253
corenrn_param.datpath.c_str(), restore_path.c_str(), &corenrn_param.mindelay);
254254

255255
// Allgather spike compression and bin queuing.

coreneuron/io/mk_mech.cpp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,6 @@ extern int nrn_nobanner_;
5050

5151
// NB: this should go away
5252
extern const char* nrn_version(int);
53-
54-
bool nrn_need_byteswap;
55-
// following copied (except for nrn_need_byteswap line) from NEURON ivocvect.cpp
56-
#define BYTEHEADER \
57-
uint32_t _II__; \
58-
char* _IN__; \
59-
char _OUT__[16]; \
60-
bool BYTESWAP_FLAG = false;
61-
#define BYTESWAP(_X__, _TYPE__) \
62-
BYTESWAP_FLAG = nrn_need_byteswap; \
63-
if (BYTESWAP_FLAG) { \
64-
_IN__ = (char*)&(_X__); \
65-
for (_II__ = 0; _II__ < sizeof(_TYPE__); _II__++) { \
66-
_OUT__[_II__] = _IN__[sizeof(_TYPE__) - _II__ - 1]; \
67-
} \
68-
(_X__) = *((_TYPE__*)&_OUT__); \
69-
}
70-
7153
std::map<std::string, int> mech2type;
7254

7355
extern "C" {
@@ -99,27 +81,6 @@ void mk_mech(const char* datpath) {
9981
mk_mech(fs);
10082
fs.close();
10183
}
102-
103-
{
104-
std::string fname = std::string(datpath) + "/byteswap1.dat";
105-
FILE* f = fopen(fname.c_str(), "r");
106-
if (!f) {
107-
fprintf(stderr, "Error: couldn't find byteswap1.dat file in the dataset directory \n");
108-
}
109-
nrn_assert(f);
110-
// file consists of int32_t binary 1 . After reading can decide if
111-
// binary info in files needs to be byteswapped.
112-
int32_t x;
113-
nrn_assert(fread(&x, sizeof(int32_t), 1, f) == 1);
114-
nrn_need_byteswap = false;
115-
if (x != 1) {
116-
BYTEHEADER;
117-
nrn_need_byteswap = true;
118-
BYTESWAP(x, int32_t);
119-
nrn_assert(x == 1);
120-
}
121-
fclose(f);
122-
}
12384
}
12485

12586
// we are embedded in NEURON, get info as stringstream from nrnbbcore_write.cpp
@@ -128,7 +89,6 @@ static void mk_mech() {
12889
if (already_called) {
12990
return;
13091
}
131-
nrn_need_byteswap = false;
13292
std::stringstream ss;
13393
nrn_assert(nrn2core_mkmech_info_);
13494
(*nrn2core_mkmech_info_)(ss);

coreneuron/io/nrn_setup.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ void nrn_setup_cleanup() {
399399

400400
void nrn_setup(const char* filesdat,
401401
bool is_mapping_needed,
402-
bool /* byte_swap */,
403402
bool run_setup_cleanup,
404403
const char* datpath,
405404
const char* restore_path,

coreneuron/nrniv/nrniv_decl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ extern void mk_netcvode(void);
5757
extern void nrn_p_construct(void);
5858
extern void nrn_setup(const char* filesdat,
5959
bool is_mapping_needed,
60-
bool byte_swap, // We keep it for backward API compatibility but it is not used
6160
bool run_setup_cleanup = true,
6261
const char* datapath = "",
6362
const char* restore_path = "",
@@ -73,7 +72,6 @@ extern void nrn_set_extra_thread0_vdata(void);
7372
extern Point_process* nrn_artcell_instantiate(const char* mechname);
7473
extern int nrnmpi_spike_compress(int nspike, bool gidcompress, int xchng);
7574
extern bool nrn_use_bin_queue_;
76-
extern bool nrn_need_byteswap;
7775

7876
extern void nrn_outputevent(unsigned char, double);
7977
extern void ncs2nrn_integrate(double tstop);

coreneuron/utils/nrnmutdec.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ class OMP_Mutex {
156156
void unlock() {}
157157

158158
// Lockable
159-
bool try_lock() {}
159+
bool try_lock() {
160+
return true;
161+
}
160162
};
161163
#endif
162164

0 commit comments

Comments
 (0)