0

Recently I began extending a very boost dependent project to use CUDA for its innermost loop. I thought it would be worth posting here about some odd behaviour I've been seeing though. Simply including certain boost headers will cause my first cuda call to generate a large number of kernels.

If compile and debug the following code: simplestCase.cu

#include <boost/thread.hpp>

int main(int argc, char **argv){
int *myInt;
cudaMalloc(&myInt, sizeof(int));
return 0;
}

I get the following debug message lines upon executing cudaMalloc (same behaviour if I run a kernel I've defined. Seems like anything that triggers context creation will trigger this.):

[Launch of CUDA Kernel 0 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 1 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 2 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 3 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 4 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 5 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 6 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 7 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 8 (memset32_post<<<(1,1,1),(64,1,1)>>>) on Device 0]

So far I have identified two headers that cause the problem: boost/thread.hpp boost/mpi.hpp

Here's a bit of info that may be useful in replicating the problem:

  • IDE: nSight Eclipse edition
  • OS: ubuntu 12.04 x64
  • GPU: GeForce GTX 580 (I believe my GeForce GT 520 is being used by my OS)
  • boost lib: 1.52
  • cat /proc/driver/nvidia/version:
    • NVRM version: NVIDIA UNIX x86_64 Kernel Module 310.32 Mon Jan 14 14:41:13 PST 2013
    • GCC version: gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)

project settings:

  • Properties->Build->CUDA->DeviceLinkerMode = Separate Compilation
  • Properties->Build->CUDA->GenerateGPUCode = 2.0
  • Properties->Build->Settings->ToolSettings->NVCCLinker->Libraries = boost_system
  • Properties->Name = simplest_case_example

I think that's everything.

Edit:

Thank you for bringing my attention to the fact that I hadn't asked a question. I knew I was forgetting something critical. My question is this:

It seems odd to me that very specific includes on their generate peripheral kernel calls, particularly since I don't use those includes, and I don't see how they could affect my interaction with CUDA. Should cuda be launching this many extra kernels for code I'm not even using? I see over 100 kernels launched in the project I'm working on now when the only CUDA related code I have in my project is a single cudaMalloc at the program's entry point.

Edit2:

Also happens on a Tesla K20 (kepler architecture card, whereas I think the GTX 580 is fermi).

Edit3:

Updated cuda driver to version 319.23. No change in the behaviour I mentioned above, but this did fix the debugger issues I was having in larger programs.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
longbowrocks
  • 491
  • 1
  • 5
  • 10
  • You've failed to ask a question. Although you may think the question should be obvious, it's still good practice to make it obvious. I think what you're observing is that the CUDA runtime may, at it's discretion, invoke a variety of non-obvious operations in order to handle certain tasks, such as launching "extra" kernels "under the hood". I guess what you're asking is why does the inclusion of the particular boost header cause the runtime to perform these specific kernel calls? You've used the word "problem" in your description, but I'm not sure there's any actual "problem" here. – Robert Crovella May 18 '13 at 00:52
  • I can't reproduce this on any platform I have access to... – talonmies May 19 '13 at 20:24
  • Interesting. I managed to reproduce this on a co-worker's computer. I'm not aware of any details I missed. Although I believe our computers consist of the same hardware, I believe the Graphics card should be the only possible offender in this case. – longbowrocks May 20 '13 at 16:35

1 Answers1

0

Well, still no actual issues arising from this, so I suppose it's simply stuff that happens in the background.

longbowrocks
  • 491
  • 1
  • 5
  • 10