Jump to content

Vex to open cl


Linus_r

Recommended Posts

Hi,
Im trying to translate from vex to open cl. The code is a bit complex but simplified the problem is that I cant get writing to other points in a loop to work. I tried with write back kernels and just doing it inside the main kernel but the problem is constant. 
A simplified version of the code could be something like this:
@KERNEL
{
@__density= 0;
int entries = @near_points.entries;
for (int i=0;i<entries;i++)
{
int current_pt = @near_points.comp(i);
float amnt =.1;
float currentDens = @__density.getAt(current_pt);
currentDens += amnt;
@__density.setAt(current_pt,currentDens);
@__density -= amnt;

}

}
@WRITEBACK
{
float newDens =@__density.get + @density.get; @density.set(newDens);
@density.set(newDens);
}

Basically taking some value from one point and distribution it to its neighbors. The subtraction works as intended but the addition to the other points doesnt work for some reason.

Very new to Opencl and have watched the masterclass but it doesnt seem to adress this particular problem

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...