...
 
Commits (53)
......@@ -6,14 +6,26 @@
#qmake
*.user
# ide
*.tags*
# linux
.nfs*
#swig
py/unsio/py_unsio.py
py/unsio/py_unsio_wrap.cpp
#py stuffs
dist
*egg-info*
py/swig/py_unsio.py
py/swig/*.cpp
__pycache__
py/unsio/version*
*.pyc
# tilda
*~
*.whl
py/wheels
# Compiled Object files
*.slo
......@@ -62,12 +74,11 @@ Makefile.in
/stamp-h1
# cuda
*.i
*.ii
*.gpu
*.ptx
*.cubin
*.fatbin
# unknown
taxon
#
# Copyright Jean-Charles Lambert, 2018-2019
#
# - YAML file for Continous Integration / Continous Deployement
# - unsio and python-unsio packages (RPM or DEB) are automatically
# generated at new commit for different linux distribution
# - add manylinux building for python-module
#
# - Documentation :
# https://docs.gitlab.com/ee/ci/yaml/
stages:
- build
- testpypi
- pypi
variables :
TWINE_USERNAME: jcl
TWINE_PASSWORD: $TEST_PY_PASSWD
WHEEL : 0
TESTPYPI : 0
PYPI : 0
OSX : 0
TESTPYPIOSX : 0
PYPIOSX : 0
before_script:
# clone
#- git clone https://gitlab.lam.fr/jclamber/unsio.git
#- cd unsio
#- git branch -r
#- git checkout origin/new_cmake
#
# BUILD wheels for all linux flavors/python
#
manylinux2010 :
stage : build
image : portus.lam.fr/jclamber/unsio-manylinux2010
only :
variables:
- $WHEEL == "1"
script:
# build
- CI/script/build-unsio.sh
- CI/script/build-wheel.sh
- CI/script/repair-wheel.sh
- /opt/python/cp37-cp37m/bin/python setup.py sdist -d wheel
- CI/script/test-unsio.sh
cache:
key: manylinux2010
paths:
- wheel/
artifacts:
name: "manylinux2010"
paths:
- test-*.res
- wheel/*
expire_in: 1 week
# Push wheel to testpypi repos
push-testpypi-manylinux2010:
stage: testpypi
image : portus.lam.fr/jclamber/unsio-manylinux2010
only :
variables:
- $TESTPYPI == "1"
script:
- /opt/python/cp37-cp37m/bin/python -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD --repository-url https://test.pypi.org/legacy/ ./wheel/python*unsio*manylinux2010* ./wheel/python*unsio*gz
cache:
key: manylinux2010
paths:
- wheel/
# Push wheel to pypi repos
push-pypi-manylinux2010:
stage: pypi
image : portus.lam.fr/jclamber/unsio-manylinux2010
only :
variables:
- $PYPI == "1"
script:
- /opt/python/cp37-cp37m/bin/python -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD ./wheel/python*unsio*manylinux2010* ./wheel/python*unsio*gz
cache:
key: manylinux2010
paths:
- wheel/
#
# MANYLINUX1
#
manylinux1 :
stage : build
image : portus.lam.fr/jclamber/unsio-manylinux1
only :
variables:
- $WHEEL == "1"
script:
# build
- CI/script/build-unsio-manylinux1.sh
- CI/script/build-wheel.sh
- CI/script/repair-wheel.sh
#- /opt/python/cp37-cp37m/bin/python setup.py sdist -d wheel
- CI/script/test-unsio.sh
cache:
key: manylinux1
paths:
- wheel/
artifacts:
name: "manylinux1"
paths:
- test-*.res
- wheel/*
expire_in: 1 week
# Push wheel to testpypi repos
push-testpypi-manylinux1:
stage: testpypi
image : portus.lam.fr/jclamber/unsio-manylinux1
only :
variables:
- $TESTPYPI == "1"
script:
- /opt/python/cp37-cp37m/bin/python -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD --repository-url https://test.pypi.org/legacy/ ./wheel/python*unsio*manylinux1*
cache:
key: manylinux1
paths:
- wheel/
# Push wheel to pypi repos
push-pypi-manylinux1:
stage: pypi
image : portus.lam.fr/jclamber/unsio-manylinux1
only :
variables:
- $PYPI == "1"
script:
- /opt/python/cp37-cp37m/bin/python -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD ./wheel/python*unsio*manylinux1*
cache:
key: manylinux1
paths:
- wheel/
#
# BUILD wheels for macosx
#
OSX:
stage : build
tags:
- osx_10.13.6
only :
variables:
- $OSX == "1"
script:
# build
- CI/scriptOSX/build-unsio.sh
- CI/scriptOSX/build-wheel.sh
- CI/scriptOSX/repair-wheel.sh
- CI/scriptOSX/test-unsio.sh
cache:
key: osx
paths:
- wheel/
artifacts:
name: "osx-wheel"
paths:
- test-*.res
- wheel/*
expire_in: 1 week
# Push wheel to testpypi repos
push-testpypi-OSX:
stage: testpypi
tags:
- osx_10.13.6
only :
variables:
- $TESTPYPIOSX == "1"
script:
- python3.7 -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD --repository-url https://test.pypi.org/legacy/ ./wheel/python*unsio*macosx*
cache:
key: osx
paths:
- wheel/
# Push wheel to pypi repos
push-pypi-OSX:
stage: pypi
tags:
- osx_10.13.6
only :
variables:
- $PYPIOSX == "1"
script:
- python3.7 -m twine upload --disable-progress-bar -u $TWINE_USERNAME -p $TWINE_PASSWORD ./wheel/python*unsio*macosx*
cache:
key: osx
paths:
- wheel/
#
# RPM Distros
#
opensuse42.3 :
stage : build
image: ppfb.lam.fr:5000/jcl-dev/opensuse42.3
only :
- tags
script:
# build
- ../CI/build-rpm.sh 0opensuse42.3
artifacts:
name: "opensuse42.3"
paths:
- unsio/build/*.rpm
- unsio/dist/*.rpm
- unsio/dist/*.gz
fedora28 :
stage : build
image: ppfb.lam.fr:5000/jcl-dev/fedora28
only :
- tags
script:
# build
- ../CI/build-rpm.sh 0fc28
artifacts:
name: "fedora28"
paths:
- unsio/build/*.rpm
- unsio/dist/*.rpm
- unsio/dist/*.gz
fedora27 :
stage : build
image: ppfb.lam.fr:5000/jcl-dev/fedora27
only :
- tags
script:
# build
- ../CI/build-rpm.sh 0fc27
artifacts:
name: "fedora27"
paths:
- unsio/build/*.rpm
- unsio/dist/*.rpm
- unsio/dist/*.gz
mageia6 :
stage : build
image: ppfb.lam.fr:5000/jcl-dev/mageia6
only :
- tags
script:
# build
- ../CI/build-rpm.sh 0mga6
artifacts:
name: "mageia6"
paths:
- unsio/build/*.rpm
- unsio/dist/*.rpm
- unsio/dist/*.gz
#
# DEB distos
#
ubuntu 18.04:
stage : build
image: ppfb.lam.fr:5000/jcl-dev/ubuntu18.04
only :
- tags
script:
# build
- ../CI/build-deb.sh 0ubuntu18.04
artifacts:
name: "ubuntu18.04"
paths:
- unsio/build/*.deb
- unsio/my_deb/*.deb
- unsio/my_deb/*.gz
ubuntu 16.04:
stage : build
image: ppfb.lam.fr:5000/jcl-dev/ubuntu16.04
only :
- tags
script:
# build
- ../CI/build-deb.sh 0ubuntu16.04
artifacts:
name: "ubuntu16.04"
paths:
- unsio/build/*.deb
- unsio/my_deb/*.deb
- unsio/my_deb/*.gz
......@@ -64,7 +64,7 @@ string root(string filename)
if (dotpos != NULL && strchr(dotpos, DIR_SEP) != NULL)
dotpos = NULL;
if (dotpos == NULL)
return (scopy(filename));
return (__nemo_scopy(filename));
else
return (substr(filename, 0, (dotpos - filename) - 1));
}
......@@ -79,7 +79,7 @@ string extension(string filename)
if (dotpos == NULL)
return ("");
else
return (scopy(dotpos + 1));
return (__nemo_scopy(dotpos + 1));
}
string head(string filename)
......@@ -99,9 +99,9 @@ string tail(string filename)
slashpos = strrchr(filename, DIR_SEP);
if (slashpos == NULL)
return (scopy(filename));
return (__nemo_scopy(filename));
else
return (scopy(slashpos + 1));
return (__nemo_scopy(slashpos + 1));
}
......@@ -121,7 +121,7 @@ string fullname(string filename)
char *outname;
if (*filename == DIR_SEP)
return scopy(filename);
return __nemo_scopy(filename);
if (getcwd(pathname,MAXPATHLEN) == 0)
error("Directory name too long (MAXPATHLEN=%d)",MAXPATHLEN);
n1 = strlen(pathname) + 1;
......@@ -130,7 +130,7 @@ string fullname(string filename)
if (n1+n2 < MAXPATHLEN) {
strcat(pathname,pathsep);
strcat(pathname,filename);
return scopy(pathname);
return __nemo_scopy(pathname);
} else {
outname = (char *) allocate(n1+n2+1);
sprintf(outname,"%s%c%s",pathname,DIR_SEP,filename);
......@@ -180,7 +180,7 @@ string defext(string filename, string ext)
if (forceext)
return (sconc(substr(filename, 0, xp-filename-1), ext));
else
return (scopy(filename));
return (__nemo_scopy(filename));
}
......
......@@ -281,10 +281,10 @@ void put_tes(stream str, string tag)
}
/*
* PUT_STRING: write string to a structured file.
* __nemo_PUT_STRING: write string to a structured file.
*/
void put_string(stream str, string tag, string dat)
void __nemo_put_string(stream str, string tag, string dat)
{
put_data(str, tag, CharType, dat, xstrlen(dat, 1), 0);
}
......@@ -699,11 +699,11 @@ void get_data_blocked(
/*
* GET_STRING: read a string from a structured file.
* __nemo_GET_STRING: read a string from a structured file.
* returns pointer to freshly allocated space that can be free'd
*/
string get_string(
string __nemo_get_string(
stream str, /* stream to read string from */
string tag /* tag to compare with item */
) {
......@@ -716,16 +716,16 @@ string get_string(
sspt = findstream(str); /* access assoc. info */
ipt = scantag(sspt, tag); /* scan input for tag */
if (ipt == NULL) /* check input succeeded */
error("get_string: at EOF");
error("__nemo_get_string: at EOF");
dp = ItemDim(ipt); /* get list of dimensions */
if (! streq(ItemTyp(ipt), CharType) || /* check type of item */
dp == NULL || *dp++ == 0 || *dp != 0) /* and shape of data */
error("get_string: item %s: not plural char", tag);
error("__nemo_get_string: item %s: not plural char", tag);
dlen = datlen(ipt,0);
if(dlen<0) error("get_string: %s with dlen=%d",tag,dlen); /* yuck */
if(dlen<0) error("__nemo_get_string: %s with dlen=%d",tag,dlen); /* yuck */
dat = (char *) calloc(dlen,1); /* alloc memory for string */
if (dat == NULL) /* did alloc fail? */
error("get_string: item %s: not enuf memory", tag);
error("__nemo_get_string: item %s: not enuf memory", tag);
copydata(dat, 0, dlen, ipt, str); /* copy string from input */
if (sspt->ss_stp == -1) /* item read at top level? */
freeitem(ipt, TRUE); /* yes, so free it up */
......@@ -1035,7 +1035,7 @@ local itemptr readitem(stream str, itemptr first)
*bufp++ = readitem(str, np); /* read next component */
}
*bufp = NULL; /* terminate item vector */
res = makeitem(scopy(SetType), scopy(ItemTag(ip)),
res = makeitem(__nemo_scopy(SetType), __nemo_scopy(ItemTag(ip)),
copxstr(ibuf, sizeof(itemptr)), NULL);
/* construct compound item */
freeitem(ip, TRUE); /* reclaim orig. header */
......
......@@ -454,9 +454,9 @@ void initparam(string argv[], string defv[])
maxkeys = nkeys - 1;
keys[0].keyval = argv[0];
keys[0].key = scopy("argv0");
keys[0].key = __nemo_scopy("argv0");
keys[0].val = progname = tail(argv[0]);
keys[0].help = scopy("Program name");
keys[0].help = __nemo_scopy("Program name");
keys[0].count = 0;
keys[0].upd = 0;
nzeno = (*defv[0] == ';');
......@@ -480,12 +480,12 @@ void initparam(string argv[], string defv[])
}
keys[i].keyval = defv[j];
keys[i].key = scopy(parname(defv[j]));
keys[i].val = scopy(parvalue(defv[j]));
keys[i].key = __nemo_scopy(parname(defv[j]));
keys[i].val = __nemo_scopy(parvalue(defv[j]));
if (nzeno)
keys[i].help = scopy(defv[j+1] + 1);
keys[i].help = __nemo_scopy(defv[j+1] + 1);
else
keys[i].help = scopy(parhelp(defv[j]));
keys[i].help = __nemo_scopy(parhelp(defv[j]));
keys[i].count = 0;
keys[i].upd = 1;
if (keys[i].key[strlen(keys[i].key)-1] == '#')
......@@ -494,7 +494,7 @@ void initparam(string argv[], string defv[])
keys[i].indexed = -2; /* not indexed */
keys[i].next = NULL;
if (streq(keys[i].key,"VERSION")) { /* special (last?) keyword */
version_i = scopy(keys[i].val);
version_i = __nemo_scopy(keys[i].val);
keys[i].upd = 0;
maxkeys--;
}
......@@ -532,7 +532,7 @@ void initparam(string argv[], string defv[])
if (keys[i].indexed >= -1)
error("Cannot match indexed keywords by position");
free(keys[i].val);
keys[i].val = scopy(argv[i]);
keys[i].val = __nemo_scopy(argv[i]);
keys[i].count++;
}
} else { /* match by name? */
......@@ -544,7 +544,7 @@ void initparam(string argv[], string defv[])
if (keys[j].count)
error("Parameter \"%s\" duplicated", name);
free(keys[j].val);
keys[j].val = scopy(parvalue(argv[i])); /* get value */
keys[j].val = __nemo_scopy(parvalue(argv[i])); /* get value */
keys[j].count++;
} else if (j=set_indexed(name,&idx)) { /* enter indexed keywords */
// process this indexed keyword
......@@ -561,9 +561,9 @@ void initparam(string argv[], string defv[])
}
kw->next = (keyword *) allocate(sizeof(keyword));
kw = kw->next;
kw->keyval = scopy(argv[i]);
kw->key = scopy(parname(argv[i]));
kw->val = scopy(parvalue(argv[i]));
kw->keyval = __nemo_scopy(argv[i]);
kw->key = __nemo_scopy(parname(argv[i]));
kw->val = __nemo_scopy(parvalue(argv[i]));
kw->help = 0;
kw->count = 1; // indexed keywords are never 'original'
kw->upd = 0;
......@@ -647,7 +647,7 @@ void initparam(string argv[], string defv[])
((val == NULL || streq(val, "")) && defflag) );
if (!streq(keys[i].val,val)) {
free(keys[i].val);
keys[i].val = scopy(val);
keys[i].val = __nemo_scopy(val);
keys[i].count++;
}
if (go) break;
......@@ -1397,7 +1397,7 @@ local void eval_keys(void)
*c2 = 0;
dprintf(3,"eval_keys: Modifying %s\n",keys[i].val);
free(keys[i].val);
keys[i].val = scopy(newval);
keys[i].val = __nemo_scopy(newval);
/* keys[i].count++; */
}
}
......@@ -1828,7 +1828,7 @@ local void setparam (string par, string val, string prompt)
#endif
val = line;
}
kw->val = scopy(val);
kw->val = __nemo_scopy(val);
kw->upd = 2; /* mark it as being updated */
#else
error("setparam: not compiled into getparam.c");
......@@ -2254,9 +2254,9 @@ local int addindexed(int i, string keyval, int idx)
}
kw->next = (keyword *) allocate(sizeof(keyword));
kw = kw->next;
kw->keyval = scopy(keyval);
kw->key = scopy(parname(keyval));
kw->val = scopy(parvalue(keyval));
kw->keyval = __nemo_scopy(keyval);
kw->key = __nemo_scopy(parname(keyval));
kw->val = __nemo_scopy(parvalue(keyval));
kw->help = 0;
kw->count = 1;
kw->upd = 0;
......@@ -2363,7 +2363,7 @@ local void readkeys(string mesg, bool first)
} else {
if (!streq(keys[i].val,parvalue(keybuf))) { /* if different */
free(keys[i].val); /* free old */
keys[i].val = scopy(parvalue(keybuf)); /* and patch in */
keys[i].val = __nemo_scopy(parvalue(keybuf)); /* and patch in */
}
}
}
......@@ -2863,7 +2863,7 @@ local void set_help(string arg)
{
char *cp;
help_string = scopy(arg);
help_string = __nemo_scopy(arg);
if ((cp = strpbrk(help_string,"0123456789"))!=NULL) /* isnum? */
help_level = atoi(cp); /* if so, change help_level */
}
......@@ -2909,7 +2909,7 @@ local void set_debug(string arg)
local void set_yapp(string arg)
{
yapp_string = scopy(arg);
yapp_string = __nemo_scopy(arg);
yapp_dev = atoi(yapp_string);
}
......
......@@ -70,7 +70,7 @@ int get_history(stream instr)
{
for(;;) { /* loop reading input data */
if (get_tag_ok(instr, HeadlineTag)) {
headline = get_string(instr, HeadlineTag);
headline = __nemo_get_string(instr, HeadlineTag);
dprintf(5, "get_history: headline = %s\n", headline);
} else if (get_tag_ok(instr, HistoryTag)) {
if (nhist > MAXHIST) {
......@@ -78,7 +78,7 @@ int get_history(stream instr)
MAXHIST);
return MAXHIST;
}
histbuf[nhist] = get_string(instr, HistoryTag);
histbuf[nhist] = __nemo_get_string(instr, HistoryTag);
dprintf(5, "get_history: histbuf[%d] = %s\n",
nhist, histbuf[nhist]);
freeup[nhist] = FALSE;
......@@ -104,12 +104,12 @@ int put_history(stream outstr)
}
if (headline != NULL) {
dprintf(5, "put_history: headline = %s\n", headline);
put_string(outstr, HeadlineTag, headline);
__nemo_put_string(outstr, HeadlineTag, headline);
}
dprintf(5, "put_history: writing %d history items\n", nhist);
for (i = 0; i < nhist; i++) {
dprintf(5, " histbuf[%d] = %s\n", i, histbuf[i]);
put_string(outstr, HistoryTag, histbuf[i]);
__nemo_put_string(outstr, HistoryTag, histbuf[i]);
}
/* nhist = 0; // reset counter -- why? JEB */
return 0;
......@@ -133,7 +133,7 @@ int app_history(string s)
dprintf(1, "app_history: null history string\n");
return nhist;
}
histbuf[nhist] = scopy(s);
histbuf[nhist] = __nemo_scopy(s);
freeup[nhist] = TRUE;
dprintf(9,"app_history: histbuf[%d] = %s\n", nhist, s);
nhist++;
......@@ -162,7 +162,7 @@ void reset_history()
void set_headline(string s)
{
headline = scopy(s);
headline = __nemo_scopy(s);
}
/*
......
......@@ -61,13 +61,13 @@ extern void copy_item_cvt (stream, stream, string, string *);
extern void put_set (stream, string);
extern void put_tes (stream, string);
extern void put_string ( stream, string , string );
extern void __nemo_put_string ( stream, string , string );
extern void put_data ( stream, string, string, void *, int, ...);
extern void put_data_sub ( stream, string, string, void *, int *, bool);
extern void get_set ( stream str, string tag );
extern void get_tes ( stream str, string tag );
extern string get_string ( stream str, string tag );
extern string __nemo_get_string ( stream str, string tag );
extern void get_data ( stream, string, string, void *, int, ...);
extern void get_data_coerced ( stream, string, string, void *, int, ...);
......
......@@ -12,7 +12,7 @@
/* Contents: */
/* */
/* getmem(nbytes) malloc with error checking */
/* scopy(source) returns a copy of source */
/* __nemo_scopy(source) returns a copy of source */
/* sconc(s1,s2) concatenates its arguments */
/* substr(s, p1, p2) returns substring from p1-p2 */
/* findstr(text, pat) finds index of pat in text */
......@@ -22,7 +22,7 @@
#define _strlib_h
extern char *getmem ( int nbytes );
extern string scopy ( const char *s );
extern string __nemo_scopy ( const char *s );
extern string sconc ( char *s1, char *s2 );
extern string substr ( char *s, int p1, int p2 );
extern int findstr ( char *text, char *pat );
......
This diff is collapsed.
This diff is collapsed.
......@@ -55,12 +55,12 @@
/* Variables used for reading operations */
char * io_in[MAXIO];
FILE * instr[MAXIO];
FILE * __io_instr[MAXIO];
bool read_one[MAXIO];
/* Variables used for writing operations */
char * io_out[MAXIO];
FILE * outstr[MAXIO];
FILE * __io_outstr[MAXIO];
bool save_one[MAXIO];
/* variables used to keep track of history (EXPORTED) */
......@@ -102,7 +102,6 @@ int io_nemo(char * iofile,
/* control */
static bool first=TRUE;
/* init flag */
init_flag_io();
......@@ -234,7 +233,7 @@ int io_nemo(char * iofile,
code=close_io_nemo(iofile);
else {
if (io_op) { /* operation on snaphot is reading */
code = get_data_select(iofile, rtype, io_in, read_one, instr, MAXIO,ion);
code = get_data_select(iofile, rtype, io_in, read_one, __io_instr, MAXIO,ion);
/* reajust pointers */
/*reajust_ptr();*/
if (N_io) *(ion->nbody_p) = ion->nbody;
......@@ -260,7 +259,7 @@ int io_nemo(char * iofile,
"in the field parameter for SAVE operation \n");
exit(1);
}
code = put_data_select(iofile, rtype, io_out, save_one, outstr, MAXIO,ion);
code = put_data_select(iofile, rtype, io_out, save_one, __io_outstr, MAXIO,ion);
}
}
free ((t_ion_data *) ion);
......@@ -276,8 +275,8 @@ int close_io_nemo(char * iofile)
int no_io,code;
/* check if the file is already open */
if ((no_io = get_old_file(iofile,io_in,read_one,instr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_out,save_one,outstr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_in,read_one,__io_instr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_out,save_one,__io_outstr,MAXIO)) < 0) {
fprintf(stderr,
"WARNING!! snapshot [%s] not OPEN, unable to close it\n",
iofile);
......@@ -285,7 +284,7 @@ int close_io_nemo(char * iofile)
}
else {
/* close the file open for writing */
strclose(outstr[no_io]);
strclose(__io_outstr[no_io]);
/* RAZ variables */
save_one[no_io] = FALSE;
......@@ -297,7 +296,7 @@ int close_io_nemo(char * iofile)
}
else {
/* close the file open for reading */
strclose(instr[no_io]);
strclose(__io_instr[no_io]);
/* RAZ variables */
read_one[no_io] = FALSE;
......
......@@ -61,12 +61,12 @@
/* variables for reading */
extern char * io_in[MAXIO];
extern FILE * instr[MAXIO];
extern FILE * __io_instr[MAXIO];
extern bool read_one[MAXIO];
/* variables for writing */
extern char * io_out[MAXIO];
extern FILE * outstr[MAXIO];
extern FILE * __io_outstr[MAXIO];
extern bool save_one[MAXIO];
/* variables used to keep track of history (EXPORTED) */
......@@ -227,7 +227,7 @@ int IO_NEMO_F(char * iofile,
va_end(pa);
if (io_op) { /* operation on snaphot is reading */
code = get_data_select_f(iofile, size_array, rtype, io_in, read_one, instr, MAXIO);
code = get_data_select_f(iofile, size_array, rtype, io_in, read_one, __io_instr, MAXIO);
}
else {
if (!N_io) {
......@@ -237,7 +237,7 @@ int IO_NEMO_F(char * iofile,
"You must specify \"nbody\" in the field parameter for SAVE operation \n");
exit(1);
}
code = put_data_select_f(iofile, size_array, rtype, io_out, save_one, outstr, MAXIO);
code = put_data_select_f(iofile, size_array, rtype, io_out, save_one, __io_outstr, MAXIO);
}
return code;
}
......@@ -255,8 +255,8 @@ int CLOSE_IO_NEMO_F(char * iofile,int * lg)
iofile = (char *) f_ch_to_c(iofile,*lg);
/* check if the file is already open */
if ((no_io = get_old_file(iofile,io_in,read_one,instr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_out,save_one,outstr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_in,read_one,__io_instr,MAXIO)) < 0) {
if ((no_io = get_old_file(iofile,io_out,save_one,__io_outstr,MAXIO)) < 0) {
fprintf(stderr,
"WARNING!! snapshot [%s] not OPEN, unable to close it\n",
iofile);
......@@ -264,7 +264,7 @@ int CLOSE_IO_NEMO_F(char * iofile,int * lg)
}
else {
/* close the file open for writing */
strclose(outstr[no_io]);
strclose(__io_outstr[no_io]);
/* RAZ variables */
save_one[no_io] = FALSE;
......@@ -274,7 +274,7 @@ int CLOSE_IO_NEMO_F(char * iofile,int * lg)
}
else {
/* close the file open for reading */
strclose(instr[no_io]);
strclose(__io_instr[no_io]);
/* RAZ variables */
read_one[no_io] = FALSE;
......
......@@ -20,7 +20,7 @@
/* The following routines are defined by strlib: */
/* */
/* getmem(nbytes) malloc with error checking */
/* scopy(source) returns a copy of source */
/* __nemo_scopy(source) returns a copy of source */
/* sconc(s1,s2) concatenates its arguments */
/* substr(s, p1, p2) returns substring from p1-p2 */
/* findstr(text, pat) finds index of pat in text */
......@@ -47,13 +47,13 @@ char *getmem(int nbytes)
/***************************************************************/
/* s = scopy(t); */
/* s = __nemo_scopy(t); */
/* */
/* Copies the string t into dynamically-allocated storage. */
/* see also: strdup() */
/***************************************************************/
string scopy(const_string s)
string __nemo_scopy(const_string s)
{
string result;
......
......@@ -137,7 +137,7 @@ stream stropen(const_string name, string mode)
fe = (fentry*) allocate(sizeof(fentry));
fe->next = flist;
flist = fe; /* hook into the list */
fe->name = scopy(name);
fe->name = __nemo_scopy(name);
fe->str = res;
fe->scratch = FALSE;
fe->seek = FALSE;
......@@ -203,7 +203,7 @@ stream stropen(const_string name, string mode)
fe = (fentry*) allocate(sizeof(fentry));
fe->next = flist;
flist = fe; /* hook into the list */
fe->name = scopy(tempname);
fe->name = __nemo_scopy(tempname);
fe->str = res;
fe->scratch = streq(mode,"s");
fe->seek = canSeek;
......
FROM quay.io/pypa/manylinux1_x86_64
RUN yum install -y gcc-c++ make pcre-devel ccache wget \
cfitsio-devel zlib-devel
# Install SWIG 4.0.1 + cmake3.2.12 + hdf5-1.8.21
RUN \
cd /opt &&\
curl -L 'https://sourceforge.net/projects/swig/files/swig/swig-4.0.1/swig-4.0.1.tar.gz' \
--output swig-4.0.1.tar.gz &&\
tar xzf swig-4.0.1.tar.gz &&\
cd /opt/swig-4.0.1 &&\
./configure --prefix=/opt/usr &&\
make -j4 && make install &&\
cd /opt &&\
curl -L https://cmake.org/files/v3.2/cmake-3.2.3-Linux-x86_64.sh \
--output cmake-3.2.3-Linux-x86_64.sh &&\
chmod +x cmake-3.2.3-Linux-x86_64.sh &&\
./cmake-3.2.3-Linux-x86_64.sh --prefix=/opt/usr --skip-license &&\
rm -f cmake-3.2.3-Linux-x86_64.sh &&\
cd /opt &&\
curl -L https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.21/src/hdf5-1.8.21.tar.gz \
--output hdf5-1.8.21.tar.gz &&\
tar zxvf hdf5-1.8.21.tar.gz &&\
cd hdf5-1.8.21 &&\
./configure --prefix=/opt/usr --enable-cxx &&\
make -j 4 && make install &&\
rm -rf hdf5-1.8.21.tar.gz hdf5-1.8.21
# Install numpy minimum requirements for swig
# Install twin
RUN \
/opt/python/cp27-cp27m/bin/pip install numpy==1.8.2 twine &&\
/opt/python/cp27-cp27mu/bin/pip install numpy==1.8.2 twine &&\
/opt/python/cp34-cp34m/bin/pip install numpy==1.8.2 twine &&\
/opt/python/cp35-cp35m/bin/pip install numpy==1.9.0 twine &&\
/opt/python/cp36-cp36m/bin/pip install numpy==1.11.3 twine &&\
/opt/python/cp37-cp37m/bin/pip install numpy==1.14.5 twine
# trick to resize image
FROM quay.io/pypa/manylinux1_x86_64
RUN yum install -y gcc-c++ make pcre-devel ccache wget \
cfitsio-devel zlib-devel
COPY --from=0 /opt/usr /opt/usr
COPY --from=0 /opt/python /opt/python
COPY --from=0 /opt/_internal /opt/_internal
ENV PATH /opt/usr/bin/:$PATH
FROM quay.io/pypa/manylinux2010_x86_64
RUN yum install -y gcc-c++ make pcre-devel ccache wget \
hdf5-devel cmake3 cfitsio-devel zlib-devel
# Install SWIG 4.0.1
RUN \
cd /opt &&\
curl -L 'https://sourceforge.net/projects/swig/files/swig/swig-4.0.1/swig-4.0.1.tar.gz' \
--output swig-4.0.1.tar.gz &&\
tar xzf swig-4.0.1.tar.gz &&\
cd /opt/swig-4.0.1 &&\
./configure --prefix=/opt/usr &&\
make -j4 && make install
# Install numpy minimum requirements for swig
# Install twin
RUN \
/opt/python/cp27-cp27m/bin/pip install numpy==1.8.2 twine &&\
/opt/python/cp27-cp27mu/bin/pip install numpy==1.8.2 twine &&\
/opt/python/cp34-cp34m/bin/pip install numpy==1.8.2 twine &&\
/opt/python/cp35-cp35m/bin/pip install numpy==1.9.0 twine &&\
/opt/python/cp36-cp36m/bin/pip install numpy==1.11.3 twine &&\
/opt/python/cp37-cp37m/bin/pip install numpy==1.14.5 twine
# trick to resize image
FROM quay.io/pypa/manylinux2010_x86_64
RUN yum install -y gcc-c++ make pcre-devel ccache wget \
hdf5-devel cmake3 cfitsio-devel zlib-devel
COPY --from=0 /opt/usr /opt/usr
COPY --from=0 /opt/python /opt/python
COPY --from=0 /opt/_internal /opt/_internal
ENV PATH /opt/usr/bin/:$PATH
#!/bin/bash
HDF5_ROOT=/usr/opt cmake . -DCMAKE_INSTALL_PREFIX=/usr
make -j 4
make install
#!/bin/bash
cmake3 . -DCMAKE_INSTALL_PREFIX=/usr
make -j 5
make install
#!/bin/bash
# build wheel
#PATH=/opt/usr/bin/:/opt/python/cp27-cp27m/bin:${PATH} pip wheel ./unsio/ -w wheelhouse
rm -f wheel/*unsio*manylinux*.whl wheel/*unsio*tar.gz wheelhouse/*unsio*manylinux*.whl
# build wheel
for PYBIN in /opt/python/*/bin/; do
echo "Compiling using pip version ${PYBIN}...."
PATH=/opt/usr/bin/:${PYBIN}:${PATH} pip wheel --no-deps ./ -w wheelhouse
done
#!/bin/bash
cd /
git clone https://gitlab.lam.fr/jclamber/unsio.git
cd /unsio
#git checkout --track origin/saveheader
#!/bin/bash
# Bundle external shared libraries into the wheels
for whl in wheelhouse/*unsio*.whl; do
echo "repairing $whl...."
auditwheel repair "$whl" -w ./wheel
done
#!/bin/bash
# install & test wheel
for PYPATH in /opt/python/*; do
echo "Testing with ${PYPATH}...."
PATH=/opt/usr/bin/:${PYPATH}/bin:${PATH} pip install wheel/*unsio*`basename ${PYPATH}`-manylinux*.whl
PATH=/opt/usr/bin/:${PYPATH}/bin:${PATH} python -m unsio.test.ctestunsio --out test-`basename ${PYPATH}`.res
done
#!/bin/bash
# Configure building environment
# We must deactivate RPATH (-DNO_RPATH=1) to allow to unsiolib to
# be included into the wheels
cmake . -DNO_RPATH=1
make -j 2
make install
#!/bin/bash
rm -f wheel/*unsio*osx*.whl wheelhouse/*unsio*osx*.whl
# Activate python environement
# Build wheel
for PYENV in ${HOME}/venv/unsio*; do
echo "Activate ${PYENV}...."
source ${PYENV}/bin/activate
pip wheel --no-deps ./ -w wheelhouse
deactivate
done
#!/bin/bash
# Activate python37 to have delocate-wheel
# delocate-wheel works the same with all python versions
source ${HOME}/venv/unsio37/bin/activate
# Bundle external shared libraries into the wheels
for whl in wheelhouse/*unsio*.whl; do
echo "repairing $whl...."
delocate-wheel "$whl" -w ./wheel
done
# de-activate python37
deactivate
#!/bin/bash
# Install unsio wheel for every python
# Run test program
for PYVER in 34 35 36 37; do
PYENV=${HOME}/venv/unsio${PYVER}
echo "Activate ${PYENV}...."
source ${PYENV}/bin/activate
pip install wheel/*unsio*${PYVER}*-macosx*.whl
python -m unsio.test.ctestunsio --out test-${PYVER}.res
deactivate
done
......@@ -55,7 +55,7 @@ MESSAGE( STATUS "BUILD_TYPE =" ${RELEASE} )
FIND_PACKAGE(SQLITE3)
if (APPLE)
set (HDF5_USE_STATIC_LIBRARIES TRUE)
#set (HDF5_USE_STATIC_LIBRARIES TRUE)
endif(APPLE)
FIND_PACKAGE(HDF5 COMPONENTS CXX REQUIRED)
......@@ -69,9 +69,10 @@ MESSAGE( STATUS "2) HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES})
MESSAGE(STATUS "NEMO LIGHT will be build")
add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/nemolight ${PROJECT_SOURCE_DIR}/3rdparty/nemolight/build-${CMAKE_BUILD_TYPE} )
#add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/nemolight ${PROJECT_SOURCE_DIR}/3rdparty/nemolight/build-${CMAKE_BUILD_TYPE} )
add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/nemolight)
set(NEMOLIGHT ${PROJECT_SOURCE_DIR}/3rdparty/nemolight)
set(NEMOLIB ${NEMOLIGHT}/build-${CMAKE_BUILD_TYPE}/lib)
set(NEMOLIB ${PROJECT_BINARY_DIR}/3rdparty/nemolight/lib)
set(NEMOINC ${NEMOLIGHT}/src/inc)
MESSAGE( STATUS "NEMOLIB : " ${NEMOLIB} )
......@@ -97,7 +98,15 @@ STRING(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}
# create library "uns"
add_library (unsio ${LIBTYPE} ${LIBSOURCES})
if (APPLE)
SET_TARGET_PROPERTIES(unsio PROPERTIES MACOSX_RPATH TRUE)
if (NOT NO_RPATH)
MESSAGE(STATUS "RPATH activated for UNSIO library")
SET_TARGET_PROPERTIES(unsio PROPERTIES MACOSX_RPATH TRUE)
else ()
# to deactivate RPATH compile with -DNO_RPATH=1
# it's mandatory to build wheel on MacOSX
MESSAGE(STATUS "RPATH DE-activated for UNSIO library")
endif()
endif (APPLE)
# special flags for MacOSX
......@@ -132,7 +141,9 @@ ENDIF ()#NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
MESSAGE( STATUS "--------> CMAKE_INSTALL_PREFIX =" ${CMAKE_INSTALL_PREFIX})
# following line is important for building python wheel package later from docker ci
if (NOT OSX)
set_target_properties(unsio PROPERTIES LINK_FLAGS "-Wl,-rpath=${CMAKE_INSTALL_PREFIX}/${PREFIX_LIB}")
endif()
if (OSX)
#MESSAGE(STATUS "\nAfter running \"make install\", do not forget to set your environment variable DYLD_LIBRARY_PATH using command:\n\n export DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib\n")
......
include py/swig/numpy.i
include py/unsio/numpy.i py/unsio/py_unsio.i
include src/uns.h src/snapshotinterface.h src/componentrange.h src/userselection.h src/snapshotinterface.h src/ctools.h src/version.h
exclude py/swig/py_unsio.py
exclude py/unsio/py_unsio.py py/unsio/version.py
# ABOUT
**UNSIO** (**U**niversal **N**body **S**napshot **I**nput **O**utput) is an API which perform input/output operations in a generic way,
and on different kind of nbody files format (nemo, Gadget binaries 1 and 2, Gadget hdf5, Ramses). By using this API,
a user could write only one analysis program which will work on all known files format supported by UNSIO.
It's not necessary anymore to know how is implemented a file format, UNSIO will do transparently and automatically
all the hard work for you ! With UNSIO, you will spend less time to develop your analysis program.
UNSIO comes with an integrated sqlite3 database which can be used to retrieve automatically all your data
## ABOUT
**UNSIO** (**U**niversal **N**body **S**napshot **I**nput **O**utput) is an API which perform input/output operations in a generic way,
and on different kind of nbody files format (nemo, Gadget binaries 1 and 2, Gadget hdf5, Ramses). By using this API,
a user could write only one analysis program which will work on all known files format supported by UNSIO.
It's not necessary anymore to know how is implemented a file format, UNSIO will do transparently and automatically
all the hard work for you ! With UNSIO, you will spend less time to develop your analysis program.
UNSIO comes with an integrated sqlite3 database which can be used to retrieve automatically all your data
among terabytes of hard disks.
## Features
......@@ -12,18 +12,77 @@ among terabytes of hard disks.
UNSIO can be used from different languages (C,C++,Fortran and Python)
## Supported files format :
* [NEMO](https://teuben.github.io/nemo/)
* GADGET 1 (read) [http://www.mpa-garching.mpg.de/gadget/]
* GADGET 2 (read an write)
* GADGET 3/hdf5 (reda and write)
* [RAMSES (read)](http://www.itp.uzh.ch/~teyssier/Site/RAMSES.html)
* list of files stored in a file
* simulations stored in SQLITE3 database
* [**NEMO** (read and write)](https://teuben.github.io/nemo/)
* [**GADGET 1** (read)](http://www.mpa-garching.mpg.de/gadget/)
* **GADGET 2** (read an write)
* **GADGET 3/hdf5** (read and write)
* [**RAMSES** (read)](https://bitbucket.org/rteyssie/ramses)
* **List of files** stored in a file
* Simulations stored in **SQLITE3** database
## License
UNSIO is open source and released under the terms of the [CeCILL2 Licence](http://www.cecill.info/licences/Licence_CeCILL_V2-en.html)
# Webpage
PLease visit : https://projets.lam.fr/projects/unsio
## Installing python wrapper
```console
pip install python-unsio -U
```
## to get some docstring help
```console
pydoc(unsio.input)
pydoc(unsio.output)
```
## Usage
- In the example below, we load a RAMSES simulation and we save it in GADGET3 file format
```python
import unsio.input as uns_in # unsio reading module
myfile="/home/jcl/output_00004" # input RAMSES simulation
# we instantiate a CUNS_IN object
my_in=uns_in.CUNS_IN(myfile,"gas,stars") # We select components GAS and STARS
#
# Reading
#
if my_in.nextFrame(): # load snapshot
# read stars positions
status,poss=my_in.getData("stars","pos")
# read gas positions
status,posg=my_in.getData("gas","pos")
# read gas densities
status,rho=my_in.getData("gas","rho")
# read time simulation
status,timex=my_in.getData("time")
#
# Writing
#
import unsio.output as uns_out # unsio writing module
myoutfile="snapshot.g3" # output file name
# we instantiate a CUNS_OUT object
my_out=uns_out.CUNS_OUT(myoutfile,"gadget3") # select gadget3 output format
# prepare data to be saved
# set time
status=my_out.setData(timex,"time")
# set stars positions
status=my_out.setData(poss,"stars","pos")
# set gas positions
status=my_out.setData(posg,"gas","pos")
# set gas densities
status=my_out.setData(rho,"gas","rho")
# write on file system
my_out.save()
# close
my_out.close()
```
## License
UNSIO is open source and released under the terms of the [CeCILL2 Licence](http://www.cecill.info/licences/Licence_CeCILL_V2-en.html)
## Webpage
PLease visit :
- [UNSIO project home page](https://projets.lam.fr/projects/unsio)
- [Python reading manual](https://projets.lam.fr/projects/unsio/wiki/PythonReadDataNew)
- [Python writing manual](https://projets.lam.fr/projects/unsio/wiki/PythonWriteDataNew)
# ============================================================================
# Copyright Jean-Charles LAMBERT - 2008-2015
# Centre de donneeS Astrophysiques de Marseille (CeSAM)
# e-mail: Jean-Charles.Lambert@lam.fr
# address: Aix Marseille Universite, CNRS, LAM
# Laboratoire d'Astrophysique de Marseille
# Pole de l'Etoile, site de Chateau-Gombert
# 38, rue Frederic Joliot-Curie
# 13388 Marseille cedex 13 France
# CNRS UMR 7326
# ============================================================================
# CMakeListst.txt file for UNS python library
# ============================================================================
# This is a CMake example for Python
cmake_minimum_required(VERSION 2.6)
# project name
project (py_unsio)
# extra path for NEMO
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake )
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/../cmake )
# load setup flags
include(SetupFlags)
# use ccache if any
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
# required package
FIND_PACKAGE(SWIG REQUIRED)
FIND_PACKAGE(NumPy REQUIRED)
FIND_PACKAGE(UNSIO REQUIRED)
FIND_PACKAGE(SQLITE3 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
FIND_PACKAGE(PythonLibs 2 )
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
# some status
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
MESSAGE( STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR} )
MESSAGE( STATUS "CMAKE_BUILD_TYPE =" ${CMAKE_BUILD_TYPE} )
MESSAGE( STATUS "CMAKE_CXX_FLAGS =" ${CMAKE_CXX_FLAGS} )
MESSAGE( STATUS "LIBRARY TYPE =" ${LIBTYPE} )
MESSAGE( STATUS "core OPT =" ${OPT} )
MESSAGE( STATUS "OSX detected =" ${OSX} )
MESSAGE( STATUS "BUILD_TYPE =" ${RELEASE} )
MESSAGE(STATUS "PYTHON_INCLUDE_PATH:" ${PYTHON_INCLUDE_PATH})
MESSAGE(STATUS "PYTHON_INCLUDE_DIRS:" ${PYTHON_INCLUDE_DIRS})
MESSAGE(STATUS "PYTHON_LIBRARY :" ${PYTHON_LIBRARY})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/swig ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/../src ${NUMPY_INCLUDE_DIRS})
# Set definitions
set (INTERFACE swig/py_unsio.i)
set (MODULENAME py_unsio)
# Find all LIB's sources files
FILE(GLOB execpp_sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h )
SET(CMAKE_SWIG_FLAGS "-c++")
SET_SOURCE_FILES_PROPERTIES(${INTERFACE} PROPERTIES CPLUSPLUS ON)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/swig)
set(CMAKE_SWIG_OUTDIR ${PROJECT_BINARY_DIR}/swig)
IF (OSX) # Mac OSX
SET(SOEXT "dylib")
ELSE (OSX) # Linux
SET(SOEXT "so")
ENDIF(OSX)
SWIG_ADD_MODULE(${MODULENAME} python ${INTERFACE} ${execpp_sources} ${UNSIOPATH}/lib/libunsio.${SOEXT} )
SWIG_LINK_LIBRARIES(${MODULENAME} ${PYTHON_LIBRARIES} ${UNSIOPATH}/lib/libunsio.${SOEXT} ${SQLITE3_LIB_PATH}/libsqlite3.${SOEXT} )
# ----------------------------------------------------------
# Install SETUP
# ----------------------------------------------------------
mark_as_advanced(CMAKE_INSTALL_PREFIX)
set (CMAKE_INSTALL_PREFIX ${UNSIOPATH})
MESSAGE( STATUS "--------> CMAKE_INSTALL_PREFIX =" ${CMAKE_INSTALL_PREFIX})
INSTALL(FILES ${PROJECT_BINARY_DIR}/_${MODULENAME}.so DESTINATION py/modules)
INSTALL(FILES ${PROJECT_BINARY_DIR}/swig/${MODULENAME}.py DESTINATION py/modules)
MESSAGE( STATUS "\nAfter running \"make install\", do no forget to set PYTHONPATH variable with command:\n export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/py/modules\n\n")
#
Python unsio wrapper installation
*) Requirements
*) Pypi
=====
the easy way to install unsio python wrapper is to use pip command
pip install python-unsio
*) compilation
============
**) requirements
Before installing python unsio wrapper you must install UNSIO (see
INSTALL in UNSIO directory)
......@@ -13,73 +22,10 @@ tools can be installed directly from your distribution or downloaded
from "here :":http://www.cmake.org/cmake/resources/software.html. You
need also the SWIG library, and numpy development library.
*) Configuration
=============
(We assume that UNSIOSRC specify your UNSIO sources directory, and
UNSIOPATH your UNSIO installation path directory)
To configure python unsio wrapper, do the following :
cd UNSIOSRC/py
mkdir build
cd build
cmake ..
You can add several options to command "cmake". The most important ones are:
-DCMAKE_BUILD_TYPE=<Debug|Release> build type [Debug]
Here are different scenarios :
*) default configuration (no options added)
cd UNSIOSRC/py
mkdir build-debug
cd build-debug
cmake ..
Will configure *py_unsio* in "debug" mode
*) release mode (with optimizations enabled)
cd UNSIOSRC/py
mkdir build-release
cd build-release
cmake .. -DCMAKE_BUILD_TYPE=Release
**) setup
python setup.py install
Will configure *py_unsio* in "release" mode with shared library.
*) so forth and so on.....
Note that CMake maintains a cache name "CMakeCache.txt". If you change
options (or your environment changes), it is best to remove that file
to avoid problems.
*) Building
========
To build py_unsio library, enter