Healpix segfault

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Jude Bowyer
Posts: 3
Joined: December 07 2007
Affiliation: Imperial College London

Healpix segfault

Post by Jude Bowyer » May 14 2008

Hi guys,

This is probably a very basic question, but I can't seem to rid myself of a segmentation fault I get whenever I read a fits file into Healpix using c++.
The code I'm using is basically this:

#include <cxxutils.h>
#include <paramfile.h>
#include <simparams.h>
#include <healpix_map.h>
#include <healpix_map_fitsio.h>
#include <fitshandle.h>

int main (void){

const std::string infile = "map.fits";

Healpix_Map<double> inmap;
read_Healpix_map_from_fits(infile,inmap,1,2); //segfault occurs here

}


Any ideas?

Thanks

Jude

Martin Reinecke
Posts: 13
Joined: July 26 2006
Affiliation: Max-Planck-Institute for Astrophysics

Healpix segfault

Post by Martin Reinecke » May 15 2008

Hmm, at first glance the code looks fine.
Are you trying to read a very large map file? It could be that you are exceeding some memory limits on your machine...
Otherwise, if the map file is not too large, could you please post a link where it can be downloaded so that I can try to reproduce this?

Cheers,
Martin

Jude Bowyer
Posts: 3
Joined: December 07 2007
Affiliation: Imperial College London

Healpix segfault

Post by Jude Bowyer » May 15 2008

Hi Martin,

I've sent you a copy of the code and file - it's only 2.3MB. The map file is the same one which is in the healpix 'test' directory.


Thanks

Jude

Pascal Vaudrevange
Posts: 50
Joined: March 26 2006
Affiliation: DESY
Contact:

Healpix segfault

Post by Pascal Vaudrevange » May 15 2008

What are the default memory limits on your system? Depending on your shell, run

Code: Select all

ulimit -a &#40;bash&#41;
limit &#40;tcsh&#41;
Try setting the stacksize to unlimited with

Code: Select all

ulimit -s unlimited &#40;bash&#41;
limit s unlimited &#40;tcsh&#41;

Martin Reinecke
Posts: 13
Joined: July 26 2006
Affiliation: Max-Planck-Institute for Astrophysics

Healpix segfault

Post by Martin Reinecke » May 15 2008

Hmm, since the file is only 2.3 MB, and the map is not allocated on the stack, I fear that system limits are not the culprit :(

Post Reply