0
votes

I'm trying to compile my CUDA C code for a GPU with sm_10 architecture which does not support invoking malloc from __global__ functions.

I need to keep a tree for which the nodes are created dynamically in the GPU memory. Unfortunately, without malloc apparently I can't do that.

Is there is a way to copy an entire tree using cudaMalloc? I think that such an approach will just copy the root of my tree.

1
Can you show your code please? - StormeHawke
The last part of your question isn't very clear. What do you mean by copy an entire tree using cudaMalloc? cudaMalloc is used only to allocate memory. Could you also explain why do you expect that by cudaMalloc you will only be able to copy the root of your tree? - Vitality

1 Answers

3
votes

Quoting the CUDA C Programming Guide

Dynamic global memory allocation and operations are only supported by devices of compute capability 2.x and higher.

For compute capability earlier than 2.0, the only possibilities are:

  1. Use cudaMalloc from host side to allocate as much global memory as you need in your __global__ function;
  2. Use static allocation if you know the required memory size at compile time;