Model compilation fails on a Cray XE6 system

General issues of interest both for network and
individual cell parallelization.

Moderator: hines

Post Reply
bkaplan
Posts: 10
Joined: Thu Apr 22, 2010 4:34 am

Model compilation fails on a Cray XE6 system

Post by bkaplan »

Hi,
I have problems compiling a model when a specific mod file is used in a parallel environment.
The modfile is 'lcafixed.mod' from ModelDB accession number 2730 http://senselab.med.yale.edu/modeldb/Sh ... afixed.mod and compiles on my local parallel environment (Ubuntu 10.04, Neuron 7.2) without problems.
The parallel environment is a Cray XE6 system: http://www.pdc.kth.se/resources/computers/lindgren

The error I get when compiling the model using lcafixed.mod is:

Code: Select all

cc -DHAVE_CONFIG_H -I. -I.. -I/cfs/nobackup/b/bkaplan/neuron-7.2/nrn-mpi/include/nrn -I/cfs/nobackup/b/bkaplan/neuron-7.2/nrn-mpi/x86_64/lib    -g  -c lcafixed.c
PGC-W-0221-Redefinition of symbol sinf (lcafixed.c: 83)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 58)
PGC-S-0043-Redefinition of symbol, sinf (lcafixed.c: 84)
PGC-S-0039-Use of undeclared variable sinf_lcafixed (lcafixed.c: 106)
PGC-S-0074-Non-constant expression in initializer (lcafixed.c: 106)
PGC-W-0093-Type cast required for this conversion of constant (lcafixed.c: 112)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 155)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 162)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 189)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 190)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 191)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 194)
PGC-S-0102-Illegal operand types for - operator (lcafixed.c: 202)
PGC-S-0104-Non-numeric operand for multiplicative operator (lcafixed.c: 216)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 262)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 263)
PGC-S-0094-Illegal type conversion required (lcafixed.c: 273)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 281)
PGC-W-0136-Function rates has non-prototype declaration in scope (lcafixed.c: 281)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 286)
PGC-W-0136-Function _n_rates has non-prototype declaration in scope (lcafixed.c: 286)
PGC-S-0094-Illegal type conversion required (lcafixed.c: 294)
PGC-S-0094-Illegal type conversion required (lcafixed.c: 300)
PGC-S-0094-Illegal type conversion required (lcafixed.c: 306)
PGC-S-0094-Illegal type conversion required (lcafixed.c: 320)
PGC-W-0136-Function _ode_spec has non-prototype declaration in scope (lcafixed.c: 336)
PGC-W-0136-Function _ode_matsol has non-prototype declaration in scope (lcafixed.c: 357)
PGC-S-0094-Illegal type conversion required (lcafixed.c: 383)
PGC-W-0136-Function nrn_init has non-prototype declaration in scope (lcafixed.c: 391)
PGC-W-0136-Function nrn_cur has non-prototype declaration in scope (lcafixed.c: 420)
PGC-W-0136-Function nrn_jacob has non-prototype declaration in scope (lcafixed.c: 456)
PGC-W-0136-Function nrn_state has non-prototype declaration in scope (lcafixed.c: 476)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 509)
PGC-W-0156-Type not specified, 'int' assumed (lcafixed.c: 511)
PGC-W-0155-Long value is passed to a nonprototyped function - argument #1 (lcafixed.c: 516)
PGC-W-0155-Long value is passed to a nonprototyped function - argument #1 (lcafixed.c: 517)
PGC-W-0155-Long value is passed to a nonprototyped function - argument #1 (lcafixed.c: 518)
PGC-W-0155-Long value is passed to a nonprototyped function - argument #1 (lcafixed.c: 519)
PGC/x86-64 Linux 12.5-0: compilation completed with severe errors
make: *** [lcafixed.o] Error 2
The neuron 7.2 installation on the Cray seems fine to me, because running various test scripts given in nrn-7.2/src/parallel folder are running fine and compiling the model without the lcafixed.mod file is also working on the Cray.
I'm not an expert in writing / debugging modfiles, thus I would be really really happy if somebody could help me with this issue.

If the lcafixed.c file is of any help, here it is:

Code: Select all

/* Created by Language version: 6.2.0 */
/* NOT VECTORIZED */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "scoplib.h"
#undef PI
 
#include "md1redef.h"
#include "section.h"
#include "md2redef.h"

#if METHOD3
extern int _method3;
#endif

#undef exp
#define exp hoc_Exp
extern double hoc_Exp();
 
#define _threadargscomma_ /**/
#define _threadargs_ /**/
 	/*SUPPRESS 761*/
	/*SUPPRESS 762*/
	/*SUPPRESS 763*/
	/*SUPPRESS 765*/
	 extern double *getarg();
 static double *_p; static Datum *_ppvar;
 
#define t nrn_threads->_t
#define dt nrn_threads->_dt
#define gcabar _p[0]
#define ica _p[1]
#define r _p[2]
#define s _p[3]
#define Dr _p[4]
#define Ds _p[5]
#define _g _p[6]
#define _ion_ica	*_ppvar[0]._pval
#define _ion_dicadv	*_ppvar[1]._pval
 
#if MAC
#if !defined(v)
#define v _mlhv
#endif
#if !defined(h)
#define h _mlhh
#endif
#endif
 static int hoc_nrnpointerindex =  -1;
 /* external NEURON variables */
 /* declaration of user functions */
 static int _hoc_alp();
 static int _hoc_bet();
 static int _hoc_rates();
 static int _mechtype;
extern int nrn_get_mechtype();
 static _hoc_setdata() {
 Prop *_prop, *hoc_getdata_range();
 _prop = hoc_getdata_range(_mechtype);
 _p = _prop->param; _ppvar = _prop->dparam;
 ret(1.);
}
 /* connect user functions to hoc names */
 static IntFunc hoc_intfunc[] = {
 "setdata_lcafixed", _hoc_setdata,
 "alp_lcafixed", _hoc_alp,
 "bet_lcafixed", _hoc_bet,
 "rates_lcafixed", _hoc_rates,
 0, 0
};
#define alp alp_lcafixed
#define bet bet_lcafixed
 extern double alp();
 extern double bet();
 /* declare global and static user variables */
#define rtau rtau_lcafixed
 double rtau = 0;
#define rinf rinf_lcafixed
 double rinf = 0;
#define stau stau_lcafixed
 double stau = 0;
#define sinf sinf_lcafixed
 double sinf = 0;
#define usetable usetable_lcafixed
 double usetable = 1;
 /* some parameters have upper and lower limits */
 static HocParmLimits _hoc_parm_limits[] = {
 "gcabar_lcafixed", 0, 1e+09,
 "usetable_lcafixed", 0, 1,
 0,0,0
};
 static HocParmUnits _hoc_parm_units[] = {
 "stau_lcafixed", "ms",
 "rtau_lcafixed", "ms",
 "gcabar_lcafixed", "mho/cm2",
 "ica_lcafixed", "mA/cm2",
 0,0
};
 static double delta_t = 1;
 static double r0 = 0;
 static double s0 = 0;
 static double v = 0;
 /* connect global user variables to hoc */
 static DoubScal hoc_scdoub[] = {
 "sinf_lcafixed", &sinf_lcafixed,
 "rinf_lcafixed", &rinf_lcafixed,
 "stau_lcafixed", &stau_lcafixed,
 "rtau_lcafixed", &rtau_lcafixed,
 "usetable_lcafixed", &usetable_lcafixed,
 0,0
};
 static DoubVec hoc_vdoub[] = {
 0,0,0
};
 static double _sav_indep;
 static void nrn_alloc(), nrn_init(), nrn_state();
 static void nrn_cur(), nrn_jacob();
 
static int _ode_count(), _ode_map(), _ode_spec(), _ode_matsol();
 
#define _cvode_ieq _ppvar[2]._i
 /* connect range variables in _p that hoc is supposed to know about */
 static char *_mechanism[] = {
 "6.2.0",
"lcafixed",
 "gcabar_lcafixed",
 0,
 "ica_lcafixed",
 0,
 "r_lcafixed",
 "s_lcafixed",
 0,
 0};
 static Symbol* _ca_sym;
 
static void nrn_alloc(_prop)
	Prop *_prop;
{
	Prop *prop_ion, *need_memb();
	double *_p; Datum *_ppvar;
 	_p = nrn_prop_data_alloc(_mechtype, 7, _prop);
 	/*initialize range parameters*/
 	gcabar = 0.12;
 	_prop->param = _p;
 	_prop->param_size = 7;
 	_ppvar = nrn_prop_datum_alloc(_mechtype, 3, _prop);
 	_prop->dparam = _ppvar;
 	/*connect ionic variables to this model*/
 prop_ion = need_memb(_ca_sym);
 	_ppvar[0]._pval = &prop_ion->param[3]; /* ica */
 	_ppvar[1]._pval = &prop_ion->param[4]; /* _ion_dicadv */
 
}
 static _initlists();
  /* some states have an absolute tolerance */
 static Symbol** _atollist;
 static HocStateTolerance _hoc_state_tol[] = {
 0,0
};
 static void _update_ion_pointer(Datum*);
 _lcafixed_reg() {
	int _vectorized = 0;
  _initlists();
 	ion_reg("ca", -10000.);
 	_ca_sym = hoc_lookup("ca_ion");
 	register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 0);
 _mechtype = nrn_get_mechtype(_mechanism[1]);
     _nrn_thread_reg(_mechtype, 2, _update_ion_pointer);
  hoc_register_dparam_size(_mechtype, 3);
 	hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol);
 	hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist);
 	hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc);
 	ivoc_help("help ?1 lcafixed /cfs/klemming/nobackup/b/bkaplan/test/x86_64/lcafixed.mod\n");
 hoc_register_limits(_mechtype, _hoc_parm_limits);
 hoc_register_units(_mechtype, _hoc_parm_units);
 }
 static double eca = 70;
 static double *_t_sinf;
 static double *_t_rinf;
 static double *_t_stau;
 static double *_t_rtau;
static int _reset;
static char *modelname = "LCa calcium channel with fixed reversal potential";

static int error;
static int _ninits = 0;
static int _match_recurse=1;
static _modl_cleanup(){ _match_recurse=1;}
static _f_rates();
static rates();
 
static int _ode_spec1(), _ode_matsol1();
 static _n_rates();
 static int _slist1[2], _dlist1[2];
 static int states();
 
/*CVODE*/
 static int _ode_spec1 () {_reset=0;
 {
   rates ( _threadargscomma_ v ) ;
   Ds = ( sinf - s ) / stau ;
   Dr = ( rinf - r ) / rtau ;
   }
 return _reset;
}
 static int _ode_matsol1 () {
 rates ( _threadargscomma_ v ) ;
 Ds = Ds  / (1. - dt*( ( ( ( - 1.0 ) ) ) / stau )) ;
 Dr = Dr  / (1. - dt*( ( ( ( - 1.0 ) ) ) / rtau )) ;
}
 /*END CVODE*/
 static int states () {_reset=0;
 {
   rates ( _threadargscomma_ v ) ;
    s = s + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / stau)))*(- ( ( ( sinf ) ) / stau ) / ( ( ( ( - 1.0) ) ) / stau ) - s) ;
    r = r + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / rtau)))*(- ( ( ( rinf ) ) / rtau ) / ( ( ( ( - 1.0) ) ) / rtau ) - r) ;
   }
  return 0;
}
 
double alp (  _lv , _li )  
	double _lv , _li ;
 {
   double _lalp;
 if ( _li  == 0.0 ) {
     _lalp = 7.5 / ( 1.0 + exp ( ( - _lv * 1.0 + 13.0 ) / 7.0 ) ) ;
     }
   else if ( _li  == 1.0 ) {
     _lalp = 0.0068 / ( 1.0 + exp ( ( _lv * 1.0 + 30.0 ) / 12.0 ) ) ;
     }
   
return _lalp;
 }
 
static int _hoc_alp() {
  double _r;
   _r =  alp (  *getarg(1) , *getarg(2) ) ;
 ret(_r);
}
 
double bet (  _lv , _li )  
	double _lv , _li ;
 {
   double _lbet;
 if ( _li  == 0.0 ) {
     _lbet = 1.65 / ( 1.0 + exp ( ( _lv * 1.0 - 14.0 ) / 4.0 ) ) ;
     }
   else if ( _li  == 1.0 ) {
     _lbet = 0.06 / ( 1.0 + exp ( - _lv * 1.0 / 11.0 ) ) ;
     }
   
return _lbet;
 }
 
static int _hoc_bet() {
  double _r;
   _r =  bet (  *getarg(1) , *getarg(2) ) ;
 ret(_r);
}
 static double _mfac_rates, _tmin_rates;
 static _check_rates();
 static _check_rates() {
  static int _maktable=1; int _i, _j, _ix = 0;
  double _xi, _tmax;
  if (!usetable) {return;}
  if (_maktable) { double _x, _dx; _maktable=0;
   _tmin_rates =  - 100.0 ;
   _tmax =  100.0 ;
   _dx = (_tmax - _tmin_rates)/200.; _mfac_rates = 1./_dx;
   for (_i=0, _x=_tmin_rates; _i < 201; _x += _dx, _i++) {
    _f_rates(_x);
    _t_sinf[_i] = sinf;
    _t_rinf[_i] = rinf;
    _t_stau[_i] = stau;
    _t_rtau[_i] = rtau;
   }
  }
 }

 static rates(double _lv){ _check_rates();
 _n_rates(_lv);
 return;
 }

 static _n_rates(double _lv){ int _i, _j;
 double _xi, _theta;
 if (!usetable) {
 _f_rates(_lv); return; 
}
 _xi = _mfac_rates * (_lv - _tmin_rates);
 _i = (int) _xi;
 if (_xi <= 0.) {
 sinf = _t_sinf[0];
 rinf = _t_rinf[0];
 stau = _t_stau[0];
 rtau = _t_rtau[0];
 return; }
 if (_i >= 200) {
 sinf = _t_sinf[200];
 rinf = _t_rinf[200];
 stau = _t_stau[200];
 rtau = _t_rtau[200];
 return; }
 _theta = _xi - (double)_i;
 sinf = _t_sinf[_i] + _theta*(_t_sinf[_i+1] - _t_sinf[_i]);
 rinf = _t_rinf[_i] + _theta*(_t_rinf[_i+1] - _t_rinf[_i]);
 stau = _t_stau[_i] + _theta*(_t_stau[_i+1] - _t_stau[_i]);
 rtau = _t_rtau[_i] + _theta*(_t_rtau[_i+1] - _t_rtau[_i]);
 }

 
static int  _f_rates (  _lv )  
	double _lv ;
 {
   double _la , _lb ;
 _la = alp ( _threadargscomma_ _lv , 0.0 ) ;
   _lb = bet ( _threadargscomma_ _lv , 0.0 ) ;
   stau = 1.0 / ( _la + _lb ) ;
   sinf = _la / ( _la + _lb ) ;
   _la = alp ( _threadargscomma_ _lv , 1.0 ) ;
   _lb = bet ( _threadargscomma_ _lv , 1.0 ) ;
   rtau = 1.0 / ( _la + _lb ) ;
   rinf = _la / ( _la + _lb ) ;
    return 0; }
 
static int _hoc_rates() {
  double _r;
    _r = 1.;
 rates (  *getarg(1) ) ;
 ret(_r);
}
 
static int _ode_count(_type) int _type;{ return 2;}
 
static int _ode_spec(_NrnThread* _nt, _Memb_list* _ml, int _type) {
   Datum* _thread;
   Node* _nd; double _v; int _iml, _cntml;
  _cntml = _ml->_nodecount;
  _thread = _ml->_thread;
  for (_iml = 0; _iml < _cntml; ++_iml) {
    _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
    _nd = _ml->_nodelist[_iml];
    v = NODEV(_nd);
     _ode_spec1 ();
  }}
 
static int _ode_map(_ieq, _pv, _pvdot, _pp, _ppd, _atol, _type) int _ieq, _type; double** _pv, **_pvdot, *_pp, *_atol; Datum* _ppd; { 
 	int _i; _p = _pp; _ppvar = _ppd;
	_cvode_ieq = _ieq;
	for (_i=0; _i < 2; ++_i) {
		_pv[_i] = _pp + _slist1[_i];  _pvdot[_i] = _pp + _dlist1[_i];
		_cvode_abstol(_atollist, _atol, _i);
	}
 }
 
static int _ode_matsol(_NrnThread* _nt, _Memb_list* _ml, int _type) {
   Datum* _thread;
   Node* _nd; double _v; int _iml, _cntml;
  _cntml = _ml->_nodecount;
  _thread = _ml->_thread;
  for (_iml = 0; _iml < _cntml; ++_iml) {
    _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
    _nd = _ml->_nodelist[_iml];
    v = NODEV(_nd);
 _ode_matsol1 ();
 }}
 extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int);
 static void _update_ion_pointer(Datum* _ppvar) {
   nrn_update_ion_pointer(_ca_sym, _ppvar, 0, 3);
   nrn_update_ion_pointer(_ca_sym, _ppvar, 1, 4);
 }

static void initmodel() {
  int _i; double _save;_ninits++;
 _save = t;
 t = 0.0;
{
  r = r0;
  s = s0;
 {
   rates ( _threadargscomma_ v ) ;
   s = sinf ;
   r = rinf ;
   }
  _sav_indep = t; t = _save;

}
}

static void nrn_init(_NrnThread* _nt, _Memb_list* _ml, int _type){
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
    _ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
 _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
#if CACHEVEC
  if (use_cachevec) {
    _v = VEC_V(_ni[_iml]);
  }else
#endif
  {
    _nd = _ml->_nodelist[_iml];
    _v = NODEV(_nd);
  }
 v = _v;
 initmodel();
 }}

static double _nrn_current(double _v){double _current=0.;v=_v;{ {
   ica = gcabar * s * r * ( v - eca ) ;
   }
 _current += ica;

} return _current;
}

static void nrn_cur(_NrnThread* _nt, _Memb_list* _ml, int _type){
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
#if CACHEVEC
    _ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
 _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
#if CACHEVEC
  if (use_cachevec) {
    _v = VEC_V(_ni[_iml]);
  }else
#endif
  {
    _nd = _ml->_nodelist[_iml];
    _v = NODEV(_nd);
  }
 _g = _nrn_current(_v + .001);
 	{ double _dica;
  _dica = ica;
 _rhs = _nrn_current(_v);
  _ion_dicadv += (_dica - ica)/.001 ;
 	}
 _g = (_g - _rhs)/.001;
  _ion_ica += ica ;
#if CACHEVEC
  if (use_cachevec) {
	VEC_RHS(_ni[_iml]) -= _rhs;
  }else
#endif
  {
	NODERHS(_nd) -= _rhs;
  }
 
}}

static void nrn_jacob(_NrnThread* _nt, _Memb_list* _ml, int _type){
Node *_nd; int* _ni; int _iml, _cntml;
#if CACHEVEC
    _ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
 _p = _ml->_data[_iml];
#if CACHEVEC
  if (use_cachevec) {
	VEC_D(_ni[_iml]) += _g;
  }else
#endif
  {
     _nd = _ml->_nodelist[_iml];
	NODED(_nd) += _g;
  }
 
}}

static void nrn_state(_NrnThread* _nt, _Memb_list* _ml, int _type){
 double _break, _save;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
    _ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
 _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
 _nd = _ml->_nodelist[_iml];
#if CACHEVEC
  if (use_cachevec) {
    _v = VEC_V(_ni[_iml]);
  }else
#endif
  {
    _nd = _ml->_nodelist[_iml];
    _v = NODEV(_nd);
  }
 _break = t + .5*dt; _save = t;
 v=_v;
{
 { {
 for (; t < _break; t += dt) {
 error =  states();
 if(error){fprintf(stderr,"at line 52 in file lcafixed.mod:\n	SOLVE states METHOD cnexp\n"); nrn_complain(_p); abort_run(error);}
 
}}
 t = _save;
 } }}

}

static terminal(){}

static _initlists() {
 int _i; static int _first = 1;
  if (!_first) return;
 _slist1[0] = &(s) - _p;  _dlist1[0] = &(Ds) - _p;
 _slist1[1] = &(r) - _p;  _dlist1[1] = &(Dr) - _p;
   _t_sinf = makevector(201*sizeof(double));
   _t_rinf = makevector(201*sizeof(double));
   _t_stau = makevector(201*sizeof(double));
   _t_rtau = makevector(201*sizeof(double));
_first = 0;
}
Many thanks in advance!

Best regards,
Bernhard Kaplan.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Model compilation fails on a Cray XE6 system

Post by hines »

Let me get back to you in a few days. I actually have a login on Lindgren but can't use it til the end of the month when I return to my office in New Haven.
However, I see that the error messages are coming from the Portland Group compiler and I have access to another HPC machine for which that compiler
is available and it is likely I will see the same errors and will be able to adjust the mod file acordingly.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Model compilation fails on a Cray XE6 system

Post by hines »

The problem is that sinf is defined in the system math.h and pgcc does not allow redefining names without first #undef ing them.
You can edit the x86_64/lcafixed.c file and put
#undef sinf
just before
#define sinf sinf_lcafixed
and rerun nrnivmodl. But it may be simplest to edit the lcafixed.mod file and change every occurrence of sinf to another name such
as sinf1 or mysinf.
bkaplan
Posts: 10
Joined: Thu Apr 22, 2010 4:34 am

Re: Model compilation fails on a Cray XE6 system

Post by bkaplan »

Thanks a million!
Renaming sinf solved the problem.
You saved the day!
Best, Bernhard
Post Reply