Chandra-MARX / marx

Chandra X-ray Observatory ray-trace simulator
http://space.mit.edu/cxc/marx/
5 stars 4 forks source link

MARX compiled with clang returns error code, although it finishes successfully #18

Closed hamogu closed 7 years ago

hamogu commented 8 years ago

A user reported on 08/04/2015:

Dear MARX help,

I have been trying to solve an issue with the ACIS Extract package and a possible incompatibility with MARX 5.1. However, after some investigations, I found that the issue wasn’t with ACIS Extract at all. The problem is that MARX is producing an exit status of 1, which  stops ACIS Extract. However, when I examine the MARX log, there is no sign of a problem such as error/warning messages. Here is what happens:

marx @@/var/folders/hf/23m313ws41g6dvgbgfmfvl6w0000gp/T/AE.0009349.1.noindex/cache/marx.par OutputDir=/var/folders/hf/23m313ws41g6dvgbgfmfvl6w0000gp/T/AE.0009349.1.noindex/tmp/ SourceRA=189.275000 SourceDEC=62.025700 DetectorType=ACIS-I DetOffsetX=0.0014 DetOffsetY=0.0000 DetOffsetZ=0.0026 MinEnergy=1.4900 MaxEnergy=1.4900 SourceFlux=3.015e-05 AspectBlur=0.070

MARX version 5.1.0, Copyright (C) 2002-2015 Massachusetts Institute of Technology

/usr/local/share/marx/data/hrma/EKCHDOS06.rdb
Reading binary HRMA optical constants:
/usr/local/share/marx/data/hrma/iridium.dat
/usr/local/share/marx/data/hrma/corr_1.dat
/usr/local/share/marx/data/hrma/corr_3.dat
/usr/local/share/marx/data/hrma/corr_4.dat
/usr/local/share/marx/data/hrma/corr_6.dat
Reading scattering tables
/usr/local/share/marx/data/hrma/scat_p1_M.bin
/usr/local/share/marx/data/hrma/scat_h1_M.bin
/usr/local/share/marx/data/hrma/scat_p3_M.bin
/usr/local/share/marx/data/hrma/scat_h3_M.bin
/usr/local/share/marx/data/hrma/scat_p4_M.bin
/usr/local/share/marx/data/hrma/scat_h4_M.bin
/usr/local/share/marx/data/hrma/scat_p6_M.bin
/usr/local/share/marx/data/hrma/scat_h6_M.bin
Initializing ACIS-I detector...
Reading ACIS-I/S FEF File
/usr/local/share/marx/data/caldb/acisfef.fits
Opening ASPSOL fits file ../obs580/obs.asol
[Using ASPSOL dither model]
Initializing source type POINT...
System initialized.

Starting simulation.  Exposure Time set to 4.953600e+04 seconds
Collecting 100000 photons...
1684 collected.
Reflecting from HRMA
Detecting with ACIS-I

Writing output to directory '/var/folders/hf/23m313ws41g6dvgbgfmfvl6w0000gp/T/AE.0009349.1.noindex/tmp/' ...
Total photons: 1684, Total Photons detected: 819, (efficiency: 0.486342)
  (efficiency this iteration  0.486342)  Total time: 49540.490822

echo $status
1

It appears to me as if the MARX command executes successfully, but still gives a ‘1’ exit status. Do you know why this could be?

Here is what I found after some debugging: it's getting stranger (I guess I could also say "more interesting"). I've tried to run this on my office computer (CentOS Linux 64 bit, gcc 4.4.7) where I do most of my development and it works fine - see below.

However, when I compile it with clang (CentOS Linux 64 bit, clang version 3.3) or run it on my laptop (Mac OS X, Apple' XCODE compiler which is "clang" - even though Apple sets an alias so that calling "gcc" also works), I get status 1.

While we strive to make the code work with any standards complied c compiler, we have found in the past that clang is not fully compatible with gcc. The marx 5.1 release was supposed to fix that (and it did for most cases), but apparently some issues remain. I will investigate that further and see if I can fix it for the Marx 5.2 release.

hamogu commented 8 years ago

This might be the same cause as #17

hamogu commented 8 years ago

Reported by the AE developer today in his testing of MARX 5.2

hamogu commented 7 years ago

It seems that the fix to #17 solved this problem also.