# Multi gpu and constant memory help

**URL:** <https://forums.developer.nvidia.com/t/multi-gpu-and-constant-memory-help/11500>\
**Category:** CUDA Programming and Performance\
**Created:** [August 11, 2009, 9:17am UTC](https://forums.developer.nvidia.com/t/multi-gpu-and-constant-memory-help/11500 "2009-08-11T09:17:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![winguy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@winguy](https://forums.developer.nvidia.com/u/winguy)\
**Post date:** [August 11, 2009, 9:17am UTC](https://forums.developer.nvidia.com/t/multi-gpu-and-constant-memory-help/11500/1 "2009-08-11T09:17:15Z")

</div>

Hi,

Is it possible to use the constant memory of each device in a multi gpu setup? I’ve used constant memory for a single gpu by declaring them as global variables. Now I’m clueless as to how to declare, initialize (cudaMemcpyToSymbol) and use constant memory in the kernel for each CPU thread in a multi gpu setup. Any example codes and pointers for a beginner?

Thanks! :)

---

<div class="post-metadata">

**Author:** ![eyalhir74](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@eyalhir74](https://forums.developer.nvidia.com/u/eyalhir74)\
**Post date:** [August 11, 2009, 12:24pm UTC](https://forums.developer.nvidia.com/t/multi-gpu-and-constant-memory-help/11500/2 "2009-08-11T12:24:37Z")

</div>

> [@](#):
>
> Hi,
> 
> Is it possible to use the constant memory of each device in a multi gpu setup? I’ve used constant memory for a single gpu by declaring them as global variables. Now I’m clueless as to how to declare, initialize (cudaMemcpyToSymbol) and use constant memory in the kernel for each CPU thread in a multi gpu setup. Any example codes and pointers for a beginner?
> 
> Thanks! :)

You should do it as you already do. Its bounded to the current context - i.e. if you’re in CPU thread 2 and use cudaSetDevice(2) then just copy the data

to the constant memory and use it - it will belong to GPU #2.

eyal
