Make GPU examples cmdstan 2.20.0

Hey all -

I’m trying to run the examples to make sure the GPU stuff is working. I’m running cmdstan 2.20.0 and the only make example is bernoulli.

Is this a mistake? Should cmdstand 2.20.0 or the current version be updated so that we can test out the GPU stuff?

I ran ./runTests.py test/unit -f opencl and the tests pass with flying colors. Does this mean the GPU should be good to go, even if I can’t run this test file?

Andre

EDIT: totes not G2G, just ran a model and the compilation is failing, but that’s cool I can figure it out.

Sorry which examples are you referencing?

The ones here: https://github.com/stan-dev/math/wiki/OpenCL-GPU-Routines

examples/GPU/gp3, but the only compilation examples are the bernoulli ones.

The bernoulli ones: https://github.com/stan-dev/cmdstan/tree/develop/examples/

The compilation fails, but just because I haven’t linked my amd/cuda library, whatever it is I need to point stan to

1 Like

yeah, another n00b question. How do I find the correct opencl lib? The one that has to go here:

LDFLAGS_OPENCL= -L"$(CUDA_PATH)\lib\x64" -lOpenCL

The $(CUDA_PATH).

Here’s my lspci output, I have a GPU:

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
...

there’s the GPU on line 4.

And then I’m setting the bash variable able to my cuda’s lib64 directory:

/usr/local/cuda/lib64.

I think this is the right place, but it’s still not compiling.
How do I find the appropriate directory?

here’s my clinfo -l :

Platform #0: Clover
 `-- Device #0: AMD VERDE (DRM 2.50.0, 5.3.11-200.fc30.x86_64, LLVM 8.0.0)
Platform #1: Portable Computing Language
 `-- Device #0: pthread-Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz

And here’s my make local:

STAN_OPENCL=true
OPENCL_DEVICE_ID=0
OPENCL_PLATFORM_ID=0
CC = g++
LDFLAGS_OPENCL= -L"$/usr/local/cuda/lib64" -lOpenCL

the openCL stuff is here:

     27096 Aug 26  2018 libOpenCL.so.1.1
    16 Aug 26  2018 libOpenCL.so.1 -> libOpenCL.so.1.1
      14 Aug 26  2018 libOpenCL.so -> libOpenCL.so.1
1 Like

yo forget it. I removed the $ at the beginning

OK, no idea what this means:

terminate called after throwing an instance of 'std::system_error'
  what():  compile_kernel: add input.cl:29:252: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
input.cl:29:272: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
input.cl:29:292: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
input.cl:29:459: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
input.cl:29:598: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
: Unknown error -11

any ideas? thanks for the help.

pinging @rok_cesnovar I don’t have access to a windows computer and Rok wrote the setup docs for Windows

Also I’m not sure cuda’s OpenCL will work with the AMD or Intel devices you have available

http://mc-stan.org/math/opencl_support.html

For windows AMD you have to use the old SDK. AMD took it off of their site for windows (linux users can use ROCm) @rok_cesnovar do you know a place to get that? I found a site but it’s not AMD affiliated so I don’t want to post it

You can get the windows one for intel from below

This is linux. There’s probably a mistake I’m making in my setup then.

On Linux you dont need to set the path to the OpenCL lib. If clinfo works you are all set.

1 Like

Ah, for linux you should be able to ignore the LDFLAGS_OPENCL line. We should probably highlight that in the docs

http://mc-stan.org/math/opencl_support.html

1 Like

Can you give some more info on what is the GPU you are using? 'double' requires cl_khr_fp64 extension to be enabled smells a bit like its an older GPU with no native double support, which seems a bit weird.

Yeah I’m pretty sure that’s the issue, idt the cape verde gpu supports doubles

Just tried this and my cmdstan build failed.

Weak, any way I can get it to work without a massive amount of work?

I would use your intel device