forked from teuben/nemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TODO
363 lines (251 loc) · 11.1 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
- NEMO, ZENO and falcON have too many small differences
falcON uses Position/Velocity
NEMO uses PhaseSpace
- a git branch is dealing with a better definition of
images, basically doing FORDEF instead of CDEF.
CDEF has always been a bad idea... given that most our
image work is via FITS
This branch is now very old converted from CVS.
- making galaxy models is a special art which deserves a special
section:
mkdisk
mkexpdisk
magalie
mkkd95 (GalactICS)
Made-to-measure modelling of observed galaxy dynamics
Jo Bovy, Daisuke Kawata, Jason A. S. Hunt
PRIMAL (Hunt et al)
NMAGIC
Syer & Tremaine 2009
https://ui.adsabs.harvard.edu/abs/1996MNRAS.282..223S/abstract
MacOSX problems: (a special macosx.html web page dedicated to this)
See: http://bima.astro.umd.edu/nemo/macosx.html
- configure leaves -lcrt.o etc. in, so they need manual removal
from makedefs and NEMORC.gen before continuing on
Also check http://www.astro.gla.ac.uk/users/norman/note/2004/restFP/
** most of this should be solved with the jan-2013 changes to
configure. I get a clean install on mac 10.8,
- see also:
http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html
- src/nbody/evolve/aarseth/nbody0/Makefile
need to activate F77LIBS to include -lcc_dynamic (10.3 ?)
but sometimes you to take it out again...... (10.4 ?)
GCC4 problems: (as tested on FC3/FC4)
- pgplot: needs a gfortran_gcc4.conf file for now
also: no more -fno-backslash
also: %VAL() does not seem to be supported anymore ???
also: some formatted reading that spans multi lines BAD (pgpack.f)
- no more -fno-globals for fortran
- no more -fwritable-strings in C
- -fno-globals
- g95 vs. gfortran, use the new m4 macros
- the linker is now more conservative, removing references to code
that is never used. get_atable and sqr come out in some tests
as missing...
The flag
-fno-unit-at-a-time
might work for a little bit.
- see also:
http://www.kegel.com/gcc/gcc4.html
http://womble.decadentplace.org.uk/c++/syntax-errors.html
-------------------------------------------------------------------------------
general things for 3.2.x
- make sure cfitsio stuff is ok in configure (THIS IS BROKEN NOW)
- the change in get_atable() should mean routines need to work
on buffered table read better
- ccdmath WCS is broken
- fix installation if no fortran is available
(fmath in potential not needed)
(some potential/data not needed)
- intel linker problems (use different technique to force loading?)
e.g. intel says to use
export GXX_ROOT=/usr/i686-pc-linux-gnu/gcc-bin/3.3/"
if compilers are in non-standard locations, and
export LC_ALL=C
if you're working on a non-english linux OS
- use some kind of global MAXBODY where we often use different values
**mostly done**
- falcON/utils install uses some linux dialect:
1) mkdir
mkdir --parents --mode=755 ...
on the mac this should be
mkdir -p -m 755 ....
2) linking: -rdynamic, -shared, -rpath are not understood
g++ .... -shared -o XXX.so
Walter uses:
-shared -o lib/libWDutils.so -march=i386 -mpreferred-stack-boundary=4
OSX/intel can use:
gcc -c -fno-common testlib.c
NO: gcc -dylib -flat_namespace -undefined suppress -o libtestlib.dylib testlib.o
YES: gcc -dynamiclib -o libtest.dylib -dylib t.o
on some (linux) distributions you may need to have to edit the
utils/make.gcc file (remove -march=native from OPTFLAGS :=), and edit
falcON/makedefs (remove -Wtype-limits from WARNINGS :=)
- a few snapshot I/O programs still use the old I/O, hence Position/Velocity data is
now difficult to make global.
--------------------------------------------------------------------------------
some other help on configure: [1998]
http://www.airs.com/ian/configure/
code & line coverage: (gcov, lcov)
http://ltp.sourceforge.net/coverage/lcov.php
- use cfortran? cfitsio also uses it. [1998]
- unsio (and possibly a few more modules) won't link if e.g. pgplot was enabled
with png. are some interfaces not cleanly separated? maybe via yapp_pgplot ?
- if the code has to be C++ friendly, i.e. the nemo_main() be compiled
by c++, but the rest with CC, all extern's must be wrapped in
#if defined(__cplusplus)
extern "C" {
#endif
...
#if defined(__cplusplus)
}
#endif
- getparam: an option to produce an iraf .par file?
- getparam: finish the outkeys= stuff
- zeno: some more Zeno compatibility
- overal design:
separation of functionality and data format. E.g. to compute the
statistics of a variable in either a table, a snapshot or an image
should have the same set of keywords that control the statistics.
Yet accessing the data is different. This is done rather sloppy
and slightly different in different places.
- fortran-to-C
some fortran compilers need -nofor_main to prevent main getting
linked in from the fortran library
some linkers want to link with gcc, not g77 or vice versa? This
may require a configure macro in the makefiles
- still various problems in -DSINGLEPREC mode:
- nemo_io
- rotcur/rotcurshape: cube1/cube1.sig appears to create some NaN pixels
- mkommod has problems with out of bounds intervals
- hackdens doesn't compile
- configure should use more consistent use of the
--with-xxx-yyy=DIR
where xxx is any of e.g. x11,tk,tcl,,.... libaries
and yyy is either dir if it specifies -I DIR/ionclude -L DIR/lib
include if it specifies -I DIR
lib if it specifies -L DIR
- alternatives to autoconf?
Pre Make Kit = http://pmk.sourceforge.net/
cmake (KDE uses it)
also check the Autoconf Macro Archive: http://autoconf-archive.cryp.to/
- Testfile's: also needs a program to be added to the local Makefile,
as well as in the list of programs to be installed...
that's non-intuitive
- man pages vs. doxygen; especially the introduction of C++ is showing
the aging of man pages. should we switch to doxygen?
Linking:
--------
Linking can be done with ld, or with the compiler. But which compiler?
Should it be the one main() is written in, i.e. gcc for C programs,
and gfortran/g77 for PROGRAM's ?
The FLIBS macro from autoconf defines a bunch of -L..... -lg2c (-lgfortran)
The example where this linking got problematic is the mkkd95 tools.
mknemo mkkd95
shows the complexity in failure and success.
Intel compiler 9.0 (sep 2005):
------------------------------
- some warnings in the Tk drivers
- a number of these linking problems (e.g. cpgdemo's, but also libpgplot.so)
show up when multiple .o files are combined in an executable.
IPO link: can not find "("
icc: error: problem during multi-file optimization compilation (code 1)
make[1]: [libpgplot.so] Error 1 (ignored)
=
building shared vs. static:
gfortran -shared -O2 *.f -o libfoo.so -fPIC
gfortran -O2 -c *.f; ar cr libfoo.a *.o
optimize with: -mtune=pentium4 or -ffast-math
DYLD_LIBRARY_PATH (osx) vs. -rpath-link (linux) vs. LD_LIBRARY_PATH
==
on mac a few minor issues w/ gyrfalcON:
YES: gcc -dynamiclib -o libtest.dylib -dylib t.o
$(LIB)lib$(LIBNAME).so: $(falcON_objs)
$(CXX) $^ -shared -o $@
becomes:
bad is:
g++ lib/basic.o lib/body.o lib/tree.o lib/gravity.o lib/kernel.o lib/io.o lib/partner.o lib/nbody.o lib/forcesC.o lib/tools.o lib/sample.o lib/manip.o lib/profile.o lib/bodyfunc.o lib/neighbours.o lib/PotExp.o -dynamiclib -o lib/libfalcON.dylib
and in utils/Makefile
$(LIB)libWDutils.so: $(LIB)libWDutils.dylib
$(LIB)libWDutils.dylib: $(WDutils_objs)
$(CXX) $^ -dynamiclib -o $@ $(CPUFLAGS)
few more isnan() and isinf() fixes wiht std::
- old style diff and patch
diff file.old file.new > file.patch
patch file.old -i file.patch -o file.new
diff brent.for brent_dbl.f > test/brent.patch
cd test
cp ../brent.for .
patch brent.for -i brent.patch -o brent_dbl.f
diff brent.for ..
diff brent_dbl.f ..
git tricks
----------
0) commands beginners should know
git clone URL # get a new repo from URL
git pull # update the repo
git add FILE # add a new FILE
git commit FILE # commit the FILE
git push # push the commit's
1) working with tags
git tag --list # see what tags you have
git tag nemo_4_3_2 # make a new tag (locally)
git tag -d nemo_4_3_2 # delete that tag
git push origin nemo_4_3_2 # push it out to the world
git checkout nemo_4_3_2 # switch to a tag
git checkout master # revert back
todo: see if "git push --tags" also works
2) ? can you see what will be pushed when you "git push"
since you may have done a whole bunch of "git commit"
It would say something like
"Your branch is ahead of 'origin/master' by 8 commits"
git diff --stat --cached origin/master
3) if you accidentally edited a FILE and want to "undo" it,
i.e. revert back to the original FILE:
git checkout FILE
this will silently overwrite your modified FILE with the
original version!!!
4) working with another remote upstream
Let say you work off a fork, and cloned that as you private workspace.
The original NEMO would be the upstream master:
git remote # see which ones you have
git remote add upstream https://github.com/teuben/nemo # add this one-time
git branch # check what branch you are on
git checkout master # ensure on your master
git fetch upstream # fetch the upstream
git merge upstream/master # merge in
git status # should be no new things
git push # push it to your origin
5) When pgplot changed their URL:
git remote -v
git remote rename origin teuben
git remote add origin https://github.com/astroumd/pgplot
==
ANSI-C:
https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/Standards.html#C-Language
NEMO was developed in 1986/7, using the SunOSx cc compiler. This was
several years before ANSI-C was ratified. The famous K&R V1 book was our
bible. Although slowly migrated,there are still many snippets of code
that violate the standard. Sometimes you will find this version
referred to as the K&R version of C.
C89:
gcc can compile with this using: -ansi, -std=c89 or -std=iso9899:1990
and if you add -pedantic it will display all the ansi violations
C99:
The next major revision was C99 , -std=c99 or -std=iso9899:1999.
https://gcc.gnu.org/c99status.html
C11:
-std=c11 or -std=iso9899:2011.
C2X:
What will be in the future. Here are some hints:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2494.pdf
In 2020 we started to really go over the code
c/clang
inline
VLA?s
Bad habits that need to change:
- real -> float or double
- int is there code that assumes it's 32bit?
- proc,rproc,iproc
- bool we use TRUE and FALSE a lot.
1.6.1.1 arrays are not pointers