Skip to content

Commit

Permalink
drop LINDA code (#1919)
Browse files Browse the repository at this point in the history
* drop LINDA code
* add entry and note in removed_features

Co-authored-by: nrnhines <[email protected]>
  • Loading branch information
alexsavulescu and nrnhines authored Jul 16, 2022
1 parent fc81bac commit f505247
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 160 deletions.
5 changes: 5 additions & 0 deletions docs/removed_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ To that end, the following table's columns constitute:
- This legacy macOS toolkit was deprecated in 2012 and removed from macOS 10.15
- `#1869 <https://github.com/neuronsimulator/nrn/pull/1869>`_
- 8fecd77
* - LINDA
- Linda is a coordination model that aids communication in parallel computing environments.
Side note: the bulletin board implemented within the ParallelContext is NEURON's analogy to LINDA's conceptual functionality of tuple space.
- `#1919 <https://github.com/neuronsimulator/nrn/pull/1919>`_
- a5c36e9
33 changes: 0 additions & 33 deletions src/oc/hoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,34 +227,6 @@ void nrn_exit(int i) {
exit(i);
}

#if LINDA

int hoc_retreat_flag;
#define RETREAT_SIGNAL SIGHUP

static RETSIGTYPE retreat_handler(int sig) /* catch interrupt */
{
/*ARGSUSED*/
if (hoc_retreat_flag++) {
/* never managed the first one properly */
nrn_exit(1);
}
if (!lookup("linda_retreat")) {
hoc_retreat_flag = 0;
/* user did not give us a safe retreat so it would be nice */
/* to take up later exactly at this point */
nrn_exit(1);
}
IGNORE(signal(RETREAT_SIGNAL, retreat_handler));
}

void hoc_retreat(void) {
hoc_obj_run("linda_retreat()\n", nullptr);
exit(0);
}

#endif

#if defined(WIN32) || defined(MAC)
#define HAS_SIGPIPE 0
#else
Expand Down Expand Up @@ -935,8 +907,6 @@ void hoc_main1_init(const char* pname, const char** envp) {
nrn_exit(1);
}

save_parallel_envp();

hoc_init();
initplot();
#if defined(__GO32__)
Expand Down Expand Up @@ -1000,9 +970,6 @@ int hoc_main1(int argc, const char** argv, const char** envp) /* hoc6 */

hoc_audit_from_hoc_main1(argc, argv, envp);
hoc_main1_init(argv[0], envp);
#if LINDA
signal(RETREAT_SIGNAL, retreat_handler);
#endif
#if HAS_SIGPIPE
signal(SIGPIPE, sigpipe_handler);
#endif
Expand Down
14 changes: 0 additions & 14 deletions src/oc/hocdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,21 +299,7 @@ int ilint;
#define Printf nrnpy_pr
#endif

/* EINTR handling for LINDA */
#if LINDA
#include <errno.h>
#define ERRCHK(c1) \
{ \
errno = EINTR; \
while (errno == EINTR) { \
errno = 0; \
c1 \
} \
}

#else
#define ERRCHK(c1) c1
#endif

#define IFGUI if (hoc_usegui) {
#define ENDGUI }
Expand Down
15 changes: 0 additions & 15 deletions src/oc/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ double errcheck(double d, const char* s) /* check result of library call */

int hoc_errno_check(void) {
int ierr;
#if LINDA
static parallel_eagain = 0;
#endif

#if 1
errno = 0;
return 0;
Expand Down Expand Up @@ -158,17 +154,6 @@ int hoc_errno_check(void) {
case ERANGE:
fprintf(stderr, "A math function was called that returned an out of range value\n");
break;
#if LINDA
/* regularly set by eval() and perhaps other linda commands */
case EAGAIN:
if (parallel_eagain++ == 0) {
perror("oc");
fprintf(stderr,
"oc: This error occurs often from LINDA and thus will not be further "
"reported.\n");
}
break;
#endif
default:
perror("oc");
break;
Expand Down
1 change: 0 additions & 1 deletion src/oc/oc_ansi.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ std::size_t hoc_total_array(Symbol*);
void hoc_menu_cleanup();
void frame_debug();
void hoc_oop_initaftererror();
void save_parallel_envp();
void save_parallel_argv(int, const char**);
void hoc_init();
void initplot();
Expand Down
14 changes: 0 additions & 14 deletions src/oc/ocmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ static void setnrnhome(const char* arg) {
#endif
}

#if LINDA /* LINDA (SAF) */
real_main(int argc, const char** argv, const char** envp) {
#else
int main(int argc, const char** argv, const char** envp) {
#endif
int err;
nrn_isdouble(nullptr, 0., 0.);
#if MAC
Expand All @@ -75,23 +71,13 @@ int main(int argc, const char** argv, const char** envp) {
}
#if EXPRESS
exit(0);
#else
#if LINDA
lexit(0);
#else
return err;
#endif
#endif
}


void hoc_single_event_run() { /* for interviews, ivoc make use of own main */
#if LINDA
extern int hoc_retreat_flag;
if (hoc_retreat_flag) {
hoc_retreat();
}
#endif
#if INTERVIEWS && 0
single_event_run();
#endif
Expand Down
84 changes: 1 addition & 83 deletions src/oc/parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,11 @@ void hoc_parallel_begin(void) {
strcpy(pnt, buf);
}
/* farm-out all but the first instance of the loop */
#if LINDA
/* place arguments for eval() into tuple space, Linda
doesn't seem to want to let the fxn in an eval take
arrays as args */
__linda_out("parallel sargs", sargv, senvp);
__linda_out("parallel args", parallel_argv : sargv, parallel_envp : senvp);
__linda_eval("parallel run", parallel_hoc_main(i), i);
#endif
}

#if LINDA
/* do first pass though loop on master node (first to first) */
pushx(first);
pushx(first);
#else
/* run in serial if not LINDA */
/* run in serial */
pushx(first);
pushx(last);
#endif

/* block until all instances of loop have finished */
#if LINDA
i = (int) last - (int) first;
while (i-- > 0) {
int err_val, err_num;

__linda_in("parallel run", ?err_val, ?err_num);
/* could test err_val != 0 but currently will always equal 0 */
}
#endif

/* assign value of symbol to last+1 as would be upon exiting a serial loop */
if (!ISARRAY(sym)) {
Expand Down Expand Up @@ -143,12 +118,7 @@ void hoc_parallel_end(void) {
/* need to exit after for-loop for all sub-processes */
if (parallel_sub) {
hoc_final_exit();
#if LINDA
lexit(0);
#else
exit(0);
#endif

} else {
/* assign loop counter the proper end value */
*pval = end_val;
Expand All @@ -166,20 +136,8 @@ int parallel_hoc_main(int i) {
int j, _largc;
_largv = static_cast<const char**>(emalloc(NUM_ARGS * sizeof(char*)));
_lenvp = static_cast<const char**>(emalloc(NUM_ARGS * sizeof(char*)));
#if LINDA
char name[20];

gethostname(name, 20);
Fprintf(stderr, "\nLaunching sub-process on %s.\n\t1\n", name);

__linda_in("parallel sargs", ?sargv, ?senvp);
#endif
targv = static_cast<char*>(emalloc(sargv));
tenvp = static_cast<char*>(emalloc(senvp));
/* pointers need to point to memory that will be filled by __linda_in() */
#if LINDA
__linda_in("parallel args", ? targv :, ? tenvp :);
#endif

pnt = targv;
for (j = 0; *pnt; j++) {
Expand Down Expand Up @@ -249,43 +207,3 @@ void save_parallel_argv(int argc, const char** argv) {
#endif
#endif
}

void save_parallel_envp(void) {
#if LINDA
#if !defined(__APPLE__)
extern char** environ;
char** envp = environ;
#endif
#if defined(__APPLE__)
char** envp = (*_NSGetEnviron());
#endif
char* pnt;
int j;
char** envp = environ;

/* count how long the block of memory should be */
for (j = 0; envp[j]; j++) {
pnt = envp[j];
while (*pnt++) {
senvp++;
}
senvp++; /* add room for '\0' */
}

/* need room for extra '\0' at end, each space is of size (char) */
senvp = (senvp + 1) * sizeof(char);

/* malloc blocks of memory */
parallel_envp = static_cast<char*>(emalloc(senvp));

/* place the strings into the memory block separated by '\0' */
pnt = parallel_envp;
for (j = 0; envp[j]; j++) {
strcpy(pnt, envp[j]);
/*EMPTY*/
while (*pnt++)
;
}
*pnt = '\0'; /* place extra '\0' at end */
#endif
}

0 comments on commit f505247

Please sign in to comment.