NVCC Segfault on boost::format in Host side code in .cu file

I have a class which manages memory between host and gpu and this class is designed to be run on host. It was my understanding that any host side code encounted by nvcc would be passed to the host compiler, Visual Studio cc in this case.

In the below code all I need to do is #define SEGFAULT_THE_NVCC_COMPILER and compile in the boost goodness to get nvcc to segfault.

void print_dimensions( void )

		{

			LOG_EVENT( LOG_STATUS, "Dimensions of matrix data are\n" );

			size_t index = 0;

			for(

					dimensions_itr_t i = this->mv_dimensions.begin();

				i != this->mv_dimensions.end(); i++

			)

			{

				index++;

				#ifdef SEGFAULT_THE_NVCC_COMPILER

				LOG_EVENT( LOG_STATUS,

					str(

						boost::format( "\tdim[%d] = %d\n" ) %  index % *i

					).c_str()

				);

				#endif

			}

		}

This code is copy pasted from another class which is compiled outside of a .cu file so I know for a fact it works. I know compiling boost can be a scary thing for a compiler to do, but then I read:

Paying special attention to the stuff I put in bold, I quickly realize that this statement is obviously false. With the output from my compile as proof below:

A note about the clobers. These do not appear to be an issue as the code compiles and runs, but I would be interested in removing them.

if you want to test the C++ abilities of your compiler… compile boost.

I think it is a known issue that nvcc can’t compile all of boost.

I assume you have verified that the segfault occurs inside nvcc or another NVIDIA component, not the host compiler? This is not clear to me from the build log shown. Independent of the level of C++ support in the CUDA compiler, it should not segfault. If the segfault is not attributable to the host compiler or linker, it would be helpful if you could file a compiler bug, attaching a self-contained repro case, as well as information about the platform you compiled on and the exact command line used to invoke nvcc. Thank you for your help.

Yep sorry for got to enable verbose=yes env variable before calling cmake to work it’s magic and above I stated VS cc which I recently switched from. I am now suing Unbuntu and my brain cells are still a version behind :-).

I really doubt that it has anything to do with the host compiler as this same function in another class which compiles in a .cpp file compiles just fine.

boost version is boost_1_45_0

I’ll try and come up with a simple test case make file and .cu file with cmake out of the picture. Above is the info I can obtain quickly.

the test case:

seg_fault_nvcc_compiler.cu

#include <vector>

#include <boost/format.hpp>

#include <stdio.h>

typedef size_t dimension_element_t;

typedef std::vector<dimension_element_t> dimensions_t;

typedef dimensions_t::iterator dimensions_itr_t;

#define LOG_EVENT( WARN_LEVEL, MESSAGE, ... ) printf( MESSAGE, ## __VA_ARGS__ )

#define SEGFAULT_THE_NVCC_COMPILER

void print_dimensions( void )

{

	

	dimensions_t mv_dimensions;

	mv_dimensions.push_back( 2 );

	mv_dimensions.push_back( 3 );

	mv_dimensions.push_back( 4 );

	

	LOG_EVENT( LOG_STATUS, "Dimensions of matrix data are\n" );

	size_t index = 0;

	for(

			dimensions_itr_t i = mv_dimensions.begin();

		i != mv_dimensions.end(); i++

	)

	{

		index++;

		#ifdef SEGFAULT_THE_NVCC_COMPILER

		LOG_EVENT( LOG_STATUS,

			str(

				boost::format( "\tdim[%d] = %d\n" ) %  index % *i

			).c_str()

		);

		#endif

	}

}

int main( void )

{

	print_dimensions();

}

Makefile

NVCC=/usr/local/nvidia/cuda-3.2/cuda/bin/nvcc 

NVCC_FLAGS= -m64 -DgpuBackprojectionPlugin_EXPORTS -Xcompiler ,\"-fPIC\" -g -G0 -O0 -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_13,code=\"sm_13,compute_13\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -DUSE_MATLAB=YES -DRECON_EXPORT=yes -DGPU_RECON=yes -DNVCC 

BOOST_INCLUDE_DIR_FLAG=-I/home/bdavis5/projects/NIH2009/branches/trunk/build/Linux-2.6.32-27-server/install/include 

all:

	$(NVCC) seg_fault_nvcc_compiler.cu  -c -o seg_fault_nvcc_compiler.o $(NVCC_FLAGS)   $(BOOST_INCLUDE_DIR_FLAG)

the output

Please file a bug so that our compiler team can look into this. Thanks!

That sound like a fantastic idea… how? I tried logging in as a registered developer using the links at http://developer.nvidia.com/object/gpucomputing.html and was unable to login using every user name email and password I have ever used post BBS systems. I am pretty sure I registered for this before, but I registered with the NVIDA collective again and have not received an email. I think that makes 3, 1 developer forum, 1 Nsight user, and now a third GPU Developer??? Please let me know where to enter my DNA sequence so that NVIDIA knows who I am so I can submit the bug. Or better yet just copy paste my text into the bug tool behind the 12 firewalls. I am starting to realize why the tools are still so spectacular even after version 3.2. I took the time to write the test case maybe someone there can take the time to Ctrl-C Ctrl-V the goop into the bug tracker. Crimineys

Just received my login today (Feb 7, 2011) at Noon. This bug has now been reported.

Thank you for your help and sorry for the inconvenience.