www.gpgpu.org Forum Index www.gpgpu.org
General Purpose Computation on GPUs
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to return results from kernel

 
Post new topic   Reply to topic    www.gpgpu.org Forum Index -> General Brook Discussion
View previous topic :: View next topic  
Author Message
niravshah
.


Joined: 18 Mar 2010
Posts: 11

PostPosted: Fri Jun 11, 2010 9:10 pm    Post subject: How to return results from kernel Reply with quote

I have kerne running with and want to return a set of six integers back to the host code.

Well i dont know how many set i would be getting in advance . It is possible that i might not get any.

Any thoughts on how can i do this i am attaching the kernel code here

kernel void threadABC(int startRange,out int a<> )
{
int X,Y,Z;
int A,B,C;
int gcdAB,gcdAC,gcdBC;
float N = 4093.0f;

//using the index of the output stream as the values for A,B,C
A = instance().x+startRange;
B = instance().y+startRange;
C = instance().z+startRange;

// intialising a to 0 so that when we filter the reuslts we can know that 0 means that
//location does not have a reuslt.
a=0;

gcdAB = findGcd(A,B);
gcdAC = findGcd(A,C);
gcdBC = findGcd(B,C);
if(gcdAB==1 && gcdAC==1 && gcdBC==1){
for( X = 3; X < 10; X++)
{
for( Y = 3; Y < 10; Y++)
{
for( Z = 3; Z < 10; Z++)
{
float sum = modulusPower((float)A,X)+modulusPower((float)B, Y);
float cpowerZ = modulusPower((float)C,Z);
sum = fmod(sum,N);
if(cpowerZ == sum){
// here the possible solution should be stored and returned to host code
//have to figure out the way to return the values of A,B,C,X,Y,Z to host


}

}
}
}

}

http://forums.amd.com/devforum/messageview.cfm?catid=328&threadid=133921&enterthread=y
Back to top
View user's profile Send private message Send e-mail
ryta1203
GP


Joined: 14 Jul 2006
Posts: 105

PostPosted: Tue Jun 15, 2010 2:55 pm    Post subject: Reply with quote

The "out" variable is what is returned. After the kernel is executed you just need to "write" the "out" stream back to host memory.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.gpgpu.org Forum Index -> General Brook Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group