Newbie Request

Hi,

I was asked to do an IT project for school and I would like to use CUDA in it.
I’m trying to simulate an anthill with many agents - ants and render it with DirectX.
I want user, to make .dds (or any other that DirectX and CUDA support) file to create an environment, for example big red (1.0f,0.0f,0.0f,1.0f) dot inside would be an anthill, scattered blue (0.0f,0.0f,1.0f,1.0f) dots would be food.
I want to load this texture to GPU then create lots of ants with some parameters like f_speed, f_xPos, f_yPos, b_carryingFood etc. and assign then to kernels (don’t know yet which strategy should I use 1 and per kernel or 1 ant per thread or something else).
Then ants start walking around.
When an ant is on the pixel it is white and when it leaves it changes back to black or to previous color.
When it steps on food it goes, in straight line, to the anthill to leave food in it.

  1. Is it possible to load texture from file, edit it in CUDA and render in DirectX?
  2. Is it possible to keep this texture in GPU memory, edit it in CUDA and render edited from GPU memory and don’t copy it back to host until simulation is over?
  3. Which sample from SDK would be the best to start with? I tried “simpleD3D11 Texture”, ants are “walking” but I can’t load and render my texture…

Could You please help me :)

Hello,
I’m an OpenGL/CUDA user but I’ll try to help.

Loading is done by DX functions, as far as I know. You can bind texture as CUDA input/output like in the CUDA DirectX graphics interoperability samples. The basic sample refers to vertex buffer but texture can be considered as one (I mean the raw pixel data).

MK

Hello,

On book which was very easy to read for me was CUDA by example. There is 1 dedicated to CUDA graphics interoperability.