ENCCS / OpenACC-CUDA-beginners

ENCCS introductory lesson on OpenACC and CUDA
http://enccs.github.io/OpenACC-CUDA-beginners/
8 stars 6 forks source link

adapt material to colab #6

Closed wikfeldt closed 3 years ago

wikfeldt commented 3 years ago

i'm testing to see if the exercises can be made to work with gcc and cuda libraries on colab, but running into several issues. I'll report them in this issue to see if @zhmurov or @jigo3635 have solutions.

In the pi_monte_carlo c version of the solution, I can make it work with curand by adding -I/usr/local/cuda-11.0/include/ -L/usr/local/cuda-11.0/lib64/ -lcurand to CFLAGS, but then it fails with: error: variable ‘y’ declared in enclosing ‘host_data’ region

any ideas?

jigo3635 commented 3 years ago

@wikfeldt , where did you test. these CFLGAS should be setting in the makefile.

CCFLAGS=-g -O3 -acc -Minfo=accel -ta=nvidia -L/proj/snic2021-22-274/CUDA/11.2.0/lib64 -lcurand

jigo3635 commented 3 years ago

@wikfeldt

$ cat ./compile.sh

!/bin/bash -l

module use /proj/snic2021-22-274/hpc_sdk/modulefiles module add nvhpc # make clean make $ ls Makefile compile.sh job.sh pi_MC_openacc pi_MC_openacc.c

jigo3635 commented 3 years ago

sorry, you are running on colab

wikfeldt commented 3 years ago

yes this is for making it work on Colab. If we manage to make most exercises work on Colab, we should add something like this to all Makefiles:

else ifeq ($(COMP),gnu)
CC=gcc
CCFLAGS=-g -O3 -fopenacc -I/usr/local/cuda-11.0/include/ -L/usr/local/cuda-11.0/lib64/ -lcurand
RUN=
endif
wikfeldt commented 3 years ago

this is now done