accULL and Intel OpenCL SDK

33 views
Skip to first unread message

Paolo Leoni

unread,
May 30, 2014, 11:44:52 AM5/30/14
to acc...@googlegroups.com
Hi all!
I'm having a problem with accULL:

My system is a workstation with Fedora 20 (intel i5 + HD4000 GPU + AMD Radeon GPU), I've installed Intel sdk and all other dependencies listed in README. Command "build-accull.sh" seems to be ok (I've selected only opencl, because I haven't cuda on my system) but when I type "make" in the "example" folder I've some errors...

[paolo@localhost example]$ make
bash /home/paolo/Scaricati/accull-0.3/accull -v -o pi-accULL.exe pi.acc.c
 **************************************** 
                 _    _ _      _          
                | |  | | |    | |         
   __ _  ___ ___| |  | | |    | |         
  / _` |/ __/ __| |  | | |    | |         
 | (_| | (_| (__| |__| | |____| |____     
  \__,_|\___\___|\____/|______|______|    
 **************************************** 
  
 Release 0.3 
* Verbose output
* Output executable name pi-accULL.exe
* Processing pi.acc.c to ./accull_GpVNz/pi.acc.c
* Building pi.acc.c
* Running StS translation 
Parsing pi.acc.c ....   OK 
 Migrating to Internal Representation ....  OK 
Mutating ...
 [c2frangollo] Generating code for with name _pi_random 
Warning: Following variables were not declared in any clause
i, h, n,  at region _pi_random
***** Kernel Statistics *******
 Flop count: 1 + (1 + (1 + (1 + (1 + 0))))
 Mem Access: 0
 Div. Factor: 0
 - * - 
 Filter called 
 - * - 
OK
* StS translation appears to be OK
* Building the project directory ./accull_GpVNz/pi.acc.c
* Building finished, check output
* Copying result files back to origin
/usr/local/cuda/bin/nvcc -Xcompiler -fopenmp -lrt -lcuda -lOpenCL -lrt -L/usr/local/cuda/lib64/ -lcuda -arch=sm_20 pi.o /home/paolo/Scaricati/accull-0.3/frangollo/src/libfrangollo.a -o pi-accULL.exe
/home/paolo/Scaricati/accull-0.3/accull: line 302: /usr/local/cuda/bin/nvcc: File o directory non esistente
* Finished

Can you help me?

Btw, thank you for this great software!
Paolo

Jose Lucas Grillo Lorenzo

unread,
Jun 2, 2014, 7:54:11 AM6/2/14
to acc...@googlegroups.com, paolo....@gmail.com
Hi Paolo,

backend support in accull version 0.3 is in its initial stages and it must be fine tuning carefully. Since it was released we have continued to work on new improvements and new fixed, but no later version has been released yet.

Accull version 0.3.1 has some improvements among which has a better backend support. It is tagged in mercurial repository although it has not been released. Nevertheless, you can clone the repository, update it to that version and install it with build-accull.sh as usual.

cd accull
hg up 0.3.1 -C

In this revision, if you have double checked OCLSDKDIR environment variable set in env-parameters.sh, you can make this change in accull script to allow AMD OpenCL backend:

@@ -7,7 +7,7 @@
 PYTHONBIN="python"
 
 # Default accULL backend is CUDA
-export ACCULL_NVIDIA_CUDA_BACKEND=1
+export ACCULL_AMD_OPENCL_BACKEND=1


accull 0.3.1 version has not been fully checked with AMD gpus, that's why your feedback will be really appreciated.

Regards.

     J. Lucas Grillo


--
You received this message because you are subscribed to the Google Groups "accULL Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accull+un...@googlegroups.com.
To post to this group, send email to acc...@googlegroups.com.
Visit this group at http://groups.google.com/group/accull.
For more options, visit https://groups.google.com/d/optout.

Paolo Leoni

unread,
Jun 2, 2014, 9:29:03 AM6/2/14
to Jose Lucas Grillo Lorenzo, acc...@googlegroups.com
Hi Jose,
thank you for your response.
Now I'm able to compile example code with success.

I'm trying to compile this simple code that I've found on the web (gol.c):

But I've a parsing error:

Release 0.3 
* Verbose output
* Output executable name gol.exe
* Processing gol.c to ./accull_ulB0S/gol.c
* Building gol.c
* Running StS translation 
Parsing gol.c ....  gol.c :
13:    but WITHOUT ANY WARRANTY; without even the implied warranty of
14:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15:    Lesser General Public License for more details.
16: 
17:    You should have received a copy of the GNU Lesser General Public
18:    License along with the GNU C Library; if not, see
20: 
21: 

ParseError: gol.c:17: before: return 

Traceback (most recent call last):
  File "/home/paolo/Miotemp/accull/accull/yacf//bin/c2frangollo.py", line 139, in <module>
    [ast_, prepro_class, lexer_class, parser_class,] = FrontendFactory().parse_with_language_list(original_source, filename, config.CURRENT_LANGUAGES,dirs)
  File "/home/paolo/Miotemp/accull/accull/yacf/Frontend/FrontendFactory.py", line 192, in parse_with_language_list
    raise pe                
Frontend.Acc.plyparser.ParseError: <stdin>:17: before: return
! Compilation of gol.c FAILED (no Project directory build )
g++ -O3 -fopenmp -L/lib/ -lOpenCL -lrt -lm *.o /home/paolo/Miotemp/accull/accull/frangollo/src/libfrangollo.a -o gol.exe
g++: error: *.o: File o directory non esistente
* Finished

What could it be the problem?

Thank you!
Paolo

Ruymán Reyes

unread,
Jun 2, 2014, 10:59:28 AM6/2/14
to acc...@googlegroups.com, Jose Lucas Grillo Lorenzo
Hi Paolo,

I think the "inline" keyword may be the problem, can you try to remove it?

Cheers, 
  Ruyman

--
Ruymán Reyes Castro

Paolo Leoni

unread,
Jun 2, 2014, 11:31:43 AM6/2/14
to acc...@googlegroups.com, Jose Lucas Grillo Lorenzo
Hi Ruymàn,
I've removed "inline" keyword and I moved getNeighbors( ) into for cycle as explicit form.

Now I've this error:

Release 0.3 
* Verbose output
* Output executable name test.exe
* Processing gol.c to ./accull_0ZuQO/gol.c
* Building gol.c
* Running StS translation 
Parsing gol.c ....  gol.c :
15:    Lesser General Public License for more details.
16: 
17:    You should have received a copy of the GNU Lesser General Public
18:    License along with the GNU C Library; if not, see
20: 
21: 
22: 
23: 

ParseError: gol.c:19: before: bytes 

Traceback (most recent call last):
  File "/home/paolo/Miotemp/accull/accull/yacf//bin/c2frangollo.py", line 139, in <module>
    [ast_, prepro_class, lexer_class, parser_class,] = FrontendFactory().parse_with_language_list(original_source, filename, config.CURRENT_LANGUAGES,dirs)
  File "/home/paolo/Miotemp/accull/accull/yacf/Frontend/FrontendFactory.py", line 192, in parse_with_language_list
    raise pe                
Frontend.Acc.plyparser.ParseError: <stdin>:19: before: bytes
! Compilation of gol.c FAILED (no Project directory build )
g++ -O3 -fopenmp -L/lib/ -lOpenCL -lrt -lm *.o /home/paolo/Miotemp/accull/accull/frangollo/src/libfrangollo.a -o test.exe
g++: error: *.o: File o directory non esistente
* Finished

This is the code that I'm trying to compile:

#include <stdio.h>
#include <stdlib.h>
 
#define SRAND_VALUE 1985
 
#define dim 1024 // Linear game grid dimension excluding ghost cells
#define idx(i,j) ((i)*(dim+2)+(j))
 
 
int main(int argc, char* argv[]) {
    int i,j,iter;
    // Number of game iterations
    int maxIter = 1<<10;
 
    // Total number of alive cells
    int total = 0;
 
    // Total size of grid in bytes
    size_t bytes = sizeof(int)*(dim+2)*(dim+2);
 
    // Allocate square grid of (dim+2)^2 elements, 2 added for ghost cells
    int *grid = (int*) malloc(bytes);
 
    // Allocate newGrid
    int *newGrid = (int*) malloc(bytes);
 
    // Assign initial population randomly
    srand(SRAND_VALUE);
    for(i = 1; i <= dim; i++) {
        for(j = 1; j <= dim; j++) {
            grid[idx(i,j)] = rand() % 2;
        }
    }
 
  int fullSize = (dim+2)*(dim+2);
  #pragma acc data copyin(grid[0:fullSize]) create(newGrid[0:fullSize])
  {
    // Main game loop
    for (iter = 0; iter<maxIter; iter++) {
    #pragma acc kernels
    {
        // Left-Right columns
        #pragma acc loop independent
        for (i = 1; i <= dim; i++) {
            grid[idx(i,0)] = grid[idx(i,dim)];   //Copy first real column to right ghost column
            grid[idx(i,dim+1)] = grid[idx(i,1)]; //Copy last real column to left ghost column
        }
        // Top-Bottom rows
        #pragma acc loop independent
        for (j = 0; j <= dim+1; j++) {
            grid[idx(0,j)] = grid[idx(dim,j)];   //Copy first real row to bottom ghost row
            grid[idx(dim+1,j)] = grid[idx(1,j)]; //Copy last real row to top ghost row
        }
 
        // Now we loop over all cells and determine their fate
        #pragma acc loop independent
        for (i = 1; i <= dim; i++) {
            for (j = 1; j <= dim; j++) {
               // Get the number of neighbors for a given grid point
                int numNeighbors = grid[idx(i+1,j)] + grid[idx(i-1,j)] + grid[idx(i,j+1)] + grid[idx(i,j-1)] + grid[idx(i+1,j+1)] + grid[idx(i-1,j-1)] + grid[idx(i-1,j+1)] + grid[idx(i+1,j-1)];
 
                // Here we have explicitly all of the game rules
                if (grid[idx(i,j)] == 1 && numNeighbors < 2)
                    newGrid[idx(i,j)] = 0;
                else if (grid[idx(i,j)] == 1 && (numNeighbors == 2 || numNeighbors == 3))
                    newGrid[idx(i,j)] = 1;
                else if (grid[idx(i,j)] == 1 && numNeighbors > 3)
                    newGrid[idx(i,j)] = 0;
                else if (grid[idx(i,j)] == 0 && numNeighbors == 3)
                    newGrid[idx(i,j)] = 1;
                else
                    newGrid[idx(i,j)] = grid[idx(i,j)];
            }
        }
 
       // Can't switch pointers so we mannually have to copy array over
       #pragma acc loop independent
       for(i = 1; i <= dim; i++) {
           for(j = 1; j <= dim; j++) {
               grid[idx(i,j)] = newGrid[idx(i,j)];
           }
       }
    } // End ACC kernels region
    } // End main game loop
 
    // Sum up alive cells
    #pragma acc parallel
    {
        #pragma acc loop reduction(+:total)
        for (i = 1; i <= dim; i++) {
            #pragma acc loop reduction(+:total)
            for (j = 1; j <= dim; j++) {
                total += grid[idx(i,j)];
            }
        }
    }
  } // End ACC Data region
 
    // Print number of live cells
    printf("Total Alive: %d\n", total);
 
    // Release memory
    free(grid);
    free(newGrid);
 
    return 0;
}

Thank you for your patience.
Paolo

Ruymán Reyes

unread,
Jun 2, 2014, 11:36:16 AM6/2/14
to acc...@googlegroups.com, Jose Lucas Grillo Lorenzo
Hi, 

That is probably a problem with the parsing of the include file. Try typedefing size_t to unsinged long

typedef unsigned long size_t;

right before the main


--
Ruymán Reyes Castro
Reply all
Reply to author
Forward
0 new messages