cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

niravshah00
Journeyman III

Multithreaded Brook+ algorithm from a nested for loop

Also can anyone tell me how do i return results from my kernel the thing is i don't want to use the output stream, as barely 1 or 2 threads would give me result , so I don't want to filter the whole output stream in  the host code ,since the no. of threads would possibly scale (atleast i am trying to do that)

here is my kernel kernel void threadABC(int startRange,out int a<>) { int X,Y,Z; int A,B,C; int gcdAB,gcdAC,gcdBC; A = instance().x+startRange; B = instance().y+startRange; C = instance().z+startRange; gcdAB = findGcd(A,B); gcdAC = findGcd(A,C); gcdBC = findGcd(B,C); if(gcdAB==1 && gcdAC==1 && gcdBC==1){ //threadXY(instance().x+1000,instance().y+1000,instance()+1000.z,a); for( X = 3; X < 10; X++) { for( Y = 3; Y < 10; Y++) { float sum = pow((float)A, (float)X)+pow((float)B, (float)Y); float Z = (log((float)sum)/log((float)C)); float epsillon = 10E-4f; if(isWithinRange(Z,epsillon)){ } } } } } // and here is my host code int main(int argc, char ** argv) { // int i,j; unsigned int dim[] = {2,1,1}; brook::Stream<int> aStream(2,dim); //int a<10,10,10>; threadABC.domainOffset(uint4(0,0,0,0)); threadABC.domainSize(uint4(2*2,3*1,2*1)); threadABC(1000,aStream); return 0; }

0 Likes
niravshah00
Journeyman III

Multithreaded Brook+ algorithm from a nested for loop

I am very close to closing this .

 

0 Likes
gaurav_garg
Adept I

Multithreaded Brook+ algorithm from a nested for loop

Domain of execution (calling domainOffset and domainSize) is not supported for 3D streams as of now. If you check error or errorLog on your stream, you should get an error saying this feature is unsupported

0 Likes
niravshah00
Journeyman III

Multithreaded Brook+ algorithm from a nested for loop

Well when i am executing the project i dont get any error as such but "indexof called on bogus address" on the command prompt .

Is there any other way i can get what i want ?

Also can your tell me how can i return result from these threads.
There is a possiblity that none of these threads would give an answer or only few of those would .

I don't want to filter the a huge array when i know only few of them would actually have a solution.

0 Likes
hazeman
Adept II

Multithreaded Brook+ algorithm from a nested for loop

I have a question for niravshah00. Why do you use Brook+ ? It's unsupported, it's slow and the idea of using streams for parallel programming simply failed. Except for some simple cases it's much harder to write efficient code in brook then in cuda or opencl ( both are almost the same ).

If you don't have hardware for opencl you can use CAL++ ( it's quite similar to OpenCL and works on all cards supported by CAL ).

 

0 Likes
gaurav_garg
Adept I

Multithreaded Brook+ algorithm from a nested for loop

Well when i am executing the project i dont get any error as such but "indexof called on bogus address" on the command prompt .

 

Is there any other way i can get what i want ?



You will not get these errors on commandline. You need to check error on your stream. Something like-

if(outputStream.error())

{

    std::cout << outputStream.errorLog();

}

0 Likes
niravshah00
Journeyman III

Multithreaded Brook+ algorithm from a nested for loop

Originally posted by: hazeman I have a question for niravshah00. Why do you use Brook+ ? It's unsupported, it's slow and the idea of using streams for parallel programming simply failed. Except for some simple cases it's much harder to write efficient code in brook then in cuda or opencl ( both are almost the same ).

 

If you don't have hardware for opencl you can use CAL++ ( it's quite similar to OpenCL and works on all cards supported by CAL ).

 

 

 

Hi ,

Well I dont have a hardware on my laptop but in the lab I have AMD FireStream 9170.
The reason because i started using brook+ was i started this project in May 2009 when there was no support for OpenCl and now I am stuck with Brook+ because I want to finish off this by May 2010 inorder to graduate by August 2010 .
Also OpenCL does not support FireStream 9170 !
I know my question migh appear that i don't know anything about programming, but there is were limited (infact no material) resources which might help me learn brook+ .
Secondly  the equation i am sloving is very trivial so i thought it would be simpler to do with Brook+ .

I tried reading CAL tutorials in the SDK but it all looked Latin to me
I am open to suggestion and guidance .

0 Likes
niravshah00
Journeyman III

Multithreaded Brook+ algorithm from a nested for loop

Originally posted by: gaurav.garg
Well when i am executing the project i dont get any error as such but "indexof called on bogus address" on the command prompt .

 

 

 

Is there any other way i can get what i want ?



 

You will not get these errors on commandline. You need to check error on your stream. Something like-

 

if(outputStream.error())

 

{

 

    std::cout << outputStream.errorLog();

 

}

 

Gaurav ,

There is no other way for me to create more threads.
So can i argue that the best way to solve my problem is to use 2D array with domain size and then each thread in turn uses sequential loop for the parameter C and x and y (if u remember i have 5 variables A,B,C with a large range and x ,y with smaller range).
As of now that seems to be the only solution to me.

0 Likes
huafeihua116
Journeyman III

Multithreaded Brook+ algorithm from a nested for loop

The samples aren't very helpful

0 Likes
niravshah00
Journeyman III

Multithreaded Brook+ algorithm from a nested for loop

then how do we go about

0 Likes