Results 1 to 3 of 3

Thread: Strange results

  1. #1

    Strange results

    Hello again...

    I have setup two kernels and, depending on the options on the host, one of them will be executed. The problem is that if I run one kernel, and then I run again the application and choose to execute the other one, the results I get (for the first time the different kernel runs) are similar to the results of the first one. So, I have to run a kernel 2 times to get the "real" results.. Could it be any problem related to initialization of variables inside the kernel, or something related to buffers I could be missing, or something related to flushing?

    Thanks a lot

  2. #2

    Re: Strange results

    Still haven't figured this out.. can anyone give ideas of what may be happening? Code's following, if it helps:

    (Array "count" is the only local one)

    Code :
    // Some arrays initialization
    count[localID] = 0;
     
    if(idx==0)
            covered_points[idy]=0;
     
     
    // Make some calculations here, and count[i] has 0 or 1
     
     
    if(localID == 0)
    {
    	for(i=0; i<N; i++)
    	{	
    		if(count[i]==1)
    		aux ++; 		
    	}
     
    	i = get_group_id(0);
    	cvs[i] = aux;		
    }
     
     
    if(idx==0)
    {       
    	for(i=idy*1681;i<idy*1681+1681;i++) 
            {		
    		covered_points[idy] += cvs[i];
    	}
     
    	c = (100.0*covered_points[idy])/(GRID_SIZE);
    	fi = (c*c)/N;	
    }
     
    if(globaID==0)
    	*f=fi;

    I've try to setup several barriers/mem fences, but with no success.

  3. #3
    Senior Member
    Join Date
    Jul 2009
    Location
    Northern Europe
    Posts
    311

    Re: Strange results

    I can't really tell what's going on here since I don't know where localID or idx come from, but I'd suspect you have a bunch of data races. You have some loops that are walking over aux and setting cvs, but I suspect other work-items could be modifying them at the same time. If that's the case your results will depend on the order in which the work-items are executed.

Similar Threads

  1. Profiling issues and strange results
    By sunny_engineer_204 in forum OpenCL
    Replies: 0
    Last Post: 05-14-2012, 02:49 PM
  2. Replies: 5
    Last Post: 01-13-2010, 12:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •