Do function pointers increase compilation time? 30 minutes to compile

Hi all,

I have a code that uses a lot of function pointers, so that different methods can be used, depending on user input. However ever since I started extensively using function pointers, the compilation times have increased astronomically. At least I think that might be the cause. It now takes about 30 minutes to compile, and of course this really is hurting my development time. I wondered if perhaps the compiler has to create code for every possible combination of the different function pointers being used. Anyone else observed this? I’m using CUDA 4.0, latest driver, Windows XP 64 bit, a C2050 card. Below is the situation: 4 function pointers, each one has say 10 options, that’d be 1e4 different ways to run the thing.

Thanks for any help…

class GPU_Subsystem : public GPU_AbstractSubsystem
GPU_Subsystem( interpolation_t interpRadial,
interpolation_t interpAxial,
integrator_t integrator,
acceleration_t acceleration,
float gasMassAmu,
float gasTempK,
float gasPressureMTorr,
double3 globalOffsetsMM,
hostElecParams_t elecParams):error_(DEVERROR_ALLGOOD)
InterpolateRadial_ = d_interpolatation_functions[interpRadial];
InterpolateAxial_ = d_interpolatation_functions[interpAxial];
Integrate_ = d_integration_functions[integrator];
Acceleration_ = d_acceleration_functions[acceleration];
gas_ = new Gas(gasPressureMTorr,gasTempK,gasMassAmu);
elecParams_ = new GPUElecParams(elecParams,globalOffsetsMM);


A compilation time of 30 minutes clearly seems excessive. Please file a bug against the compiler, attaching a self-contained repro case, so our compiler team can have a look at this. Thank you for your help, and sorry for the inconvenience.

Alright, I have attached a zipped folder containing the GPU files, and just a dummy host file. I started compiling this thing at 5:36, and it finished at 6:43. Here is the information that you all request in the “reporting a problem” sticky, hope it is sufficient. Note that there are some host compiling errors because of how I had to strip the project down, but not until after it finishes the hour plus part that seems to be only GPU related.

Thanks, Philip

  • Operating System

Windows XP 64 bit,

Version 2003, Service Pack 2

  • Synopsis description of the problem

Compiling GPU part of code takes excessively long.

  • Detailed description of the problem

My device code has a lot of header files that just get included into one .cu file. There are a lot of function pointers that are used. Perhaps this has something to do with the fact that it takes so long to compile, or maybe I am doing something else wrong. I’d appreciate that you take a look and tell me either way.

  • CUDA toolkit release version


  • SDK release version


  • Compiler for CPU host code

Visual Studio 2008, 64 bit

  • System description including:

AMD Phenom 9950 Quad-Core, 2.60 GHz, 15.7 GB RAM

Video cards: GeForce 9800 GT, Tesla C2050

Foxconn Destroyer motherboard

Chipset : nForce 980a/780a SLI (6.79 MB)

I have exactly the same problem! Is there anything new?

I guess I was not clear enough when I suggested filing a bug. Sorry about that. I meant: Please go to NVIDIA’s registered developer website, click on the link for bug reports, and enter the relevant information into the bug database. A bug number will be assigned for later reference.

I do not look at the forums every single day (my presence here is something I do in addition to my regular engineering job), so I missed this. If the original poster is still around, could you please file a bug as indicated above? Thanks!

greg_anagno, if your GPU code takes a very long time to compile (> 30 minutes on a reasonably fast machine) I think it would make sense to file a bug. Not all instances of excessive compile times will necessarily have the same root cause. This could be a multi-causal problem, in which case multiple bug reports may help uncover all of the issues. If you file a bug report, please attach a self-contained repro case that is as small as possible while still reproducing the compile time problem.

Oh yeah sorry, i missed this. I’ll file the bug as you say.

It looks like I have to sign up to be a registered developer, which may take them 10 days, according to the website. Eventually I’ll file the bug then…

It should not take more than a few business days for the developer registration to go through provided all requested information was provided. If you experience undue delay please send me a PM through the forum and I follow up on our side. Thank you for your patience.