# GPU CI testing

**URL:** <https://discourse.mc-stan.org/t/gpu-ci-testing/2572>\
**Category:** Developers\
**Created:** [November 21, 2017, 9:25pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572 "2017-11-21T21:25:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![seantalts](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/seantalts/32/32_2.png) [@seantalts](https://discourse.mc-stan.org/u/seantalts)\
**Post date:** [November 21, 2017, 9:25pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/1 "2017-11-21T21:25:55Z")

</div>

@stevebronder sent me this message but I have some time constraints in the next couple of weeks so I want to open this up. @mitzimorris said she might be able to help with this issue. Pasted the message below:

Is the Jenkins computer a mac? Usually Mac’s should come with OpenCL, but this one does not seem to have anything available?

[http://d1m1s1b1.stat.columbia.edu:8080/job/Math%20Pull%20Request%20-%20Tests%20-%20Unit/921/console](http://d1m1s1b1.stat.columbia.edu:8080/job/Math%20Pull%20Request%20-%20Tests%20-%20Unit/921/console)

Alt, is it possible to install the AMD OpenCL for the computer on Jenkins like we do on travis?

> <https://github.com/rok-cesnovar/math/blob/gpu_stanmathcl/.travis.yml#L27>

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [November 22, 2017, 5:23pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/2 "2017-11-22T17:23:28Z")

</div>

Thanks for posting this Sean!

@mitzimorris would it be possible to add the AMD OpenCL SDK to the Jenkins computers?

I believe you can use the install script [here](https://github.com/rok-cesnovar/math/blob/b640cfa6453e0d471abf7d91216fdda94b636ad6/.travis.yml#L27) and download script [here](https://github.com/rok-cesnovar/math/blob/gpu_stanmathcl/.travis/amd_sdk.sh) on a mac to add the AMD OpenCL SDK.

---

<div class="post-metadata">

**Author:** ![maedoc](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/maedoc/32/205_2.png) [@maedoc](https://discourse.mc-stan.org/u/maedoc)\
**Post date:** [November 24, 2017, 12:36pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/3 "2017-11-24T12:36:05Z")

</div>

Apple ships OpenCL but not the C++ header only wrapper `cl.hpp`: you need to download the header and probably commit it to your repo, then it should work fine w/o AMD’s OpenCL SDK.

---

<div class="post-metadata">

**Author:** ![mitzimorris](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mitzimorris/32/29_2.png) [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Post date:** [November 29, 2017, 10:18pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/4 "2017-11-29T22:18:22Z")

</div>

hi Steve,  
saw your request and added it to my “todo” list - will send update when I get to it - sorry for the lameness.  
cheers,  
Mitzi

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [December 5, 2017, 4:11am UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/5 "2017-12-05T04:11:34Z")

</div>

@mitzimorris thanks! I believe this is the last piece the GPU side needs for testing. Once we pass Jenkins we can start the review process

@maedoc apologies, I grabbed the wrong console output from the jenkins run. In the below output you can see the tests fail because of a linker error for OpenCL and not the OpenCL header IE

```
ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```

[http://d1m1s1b1.stat.columbia.edu:8080/job/Math%20Pull%20Request%20-%20Tests%20-%20Unit/930/console](http://d1m1s1b1.stat.columbia.edu:8080/job/Math%20Pull%20Request%20-%20Tests%20-%20Unit/930/console)

---

<div class="post-metadata">

**Author:** ![maedoc](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/maedoc/32/205_2.png) [@maedoc](https://discourse.mc-stan.org/u/maedoc)\
**Post date:** [December 5, 2017, 4:52am UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/6 "2017-12-05T04:52:33Z")

</div>

Likely using `-framework OpenCL` instead of `-lOpenCL` will do the trick

---

<div class="post-metadata">

**Author:** ![wds15](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wds15/32/908_2.png) [@wds15](https://discourse.mc-stan.org/u/wds15)\
**Post date:** [December 6, 2017, 4:25pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/7 "2017-12-06T16:25:59Z")

</div>

uhm… at the risk of hijacking this… I am in a similar situation as I need to test code inside Stan with has “special” dependencies (MPI). So I am wondering how you solved the issues around

- making sure that during the tests you have access to the GPU - in terms of hardware and in terms of additional software dependencies
- what do you do with tests which rely on the presence of a GPU on machines which do not have them? Are these tests disabled and if so, how?

Thanks much!

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [December 7, 2017, 5:10pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/8 "2017-12-07T17:10:42Z")

</div>

@maedoc I think that did the trick, much appreciated!

@wds15

> - making sure that during the tests you have access to the GPU - in terms of hardware and in terms of additional software dependencies
> - what do you do with tests which rely on the presence of a GPU on machines which do not have them? Are these tests disabled and if so, how?

We are able to install the AMD-SDK for Travis which compiles the OpenCL so it runs on the CPU (see [here](https://github.com/rok-cesnovar/math/blob/gpu_stanmathcl/.travis.yml#L25)). Jenkins has OpenCL installed already (mac) and also compiles on the CPU for testing.

This [blog](https://d-meiser.github.io/2016/01/10/mpi-travis.html) seems to have a decent explanation of how to test MPI based code on Travis. For Jenkins we may have to install an MPI package

---

<div class="post-metadata">

**Author:** ![grizant](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/grizant/32/1435_2.png) [@grizant](https://discourse.mc-stan.org/u/grizant)\
**Post date:** [January 13, 2018, 2:01am UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/9 "2018-01-13T02:01:28Z")

</div>

Hello all,

I’m working on problems in which GPU integration into Stan would be extremely helpful. I talked to some of the developers at StanCon2018 about lending a hand with the effort. How get started to help contribute?

Thanks,  
Grant Schissler

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [January 13, 2018, 6:01am UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/10 "2018-01-13T06:01:24Z")

</div>

At this point we have everything working and are breaking down the GPU PR into smaller PRs for review purposes (while dotting some T’s and crossing some i’s along the way).

We could always use another reviewer!

You can see the PR’s below

1. [OpenCL Headers](https://github.com/stan-dev/math/pull/716)
2. [gpu setup](https://github.com/stan-dev/math/pull/720)
3. [matrix\_gpu](https://github.com/stan-dev/math/pull/721)

The rest are tbd. I think at this point I would rather get a green light on these three then build out the rest so that I don’t have to merge/rebase two more PRs

You can see the full PR [here](https://github.com/stan-dev/math/pull/655)

---

<div class="post-metadata">

**Author:** ![grizant](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/grizant/32/1435_2.png) [@grizant](https://discourse.mc-stan.org/u/grizant)\
**Post date:** [January 14, 2018, 8:31pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/11 "2018-01-14T20:31:25Z")

</div>

Thanks for the quick reply! Very exciting that the implementation is  
getting more mature. I’ll review the PRs and update the forum soon.

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [January 21, 2018, 12:19am UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/12 "2018-01-21T00:19:43Z")

</div>

Is Jenkins still being run on a mac? In my tests when I check for OS\_TYPE in the makefile it does the options for Linux.

If this is not run on a mac anymore can you install the amd sdk like we do for travis?

> <https://github.com/rok-cesnovar/math/blob/gpu_stanmathcl/.travis.yml#L27>

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [February 11, 2018, 4:37pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/13 "2018-02-11T16:37:10Z")

</div>

@mitzimorris @seantalts

You can see [here](http://d1m1s1b1.stat.columbia.edu:8080/blue/organizations/jenkins/Math%20Pipeline/detail/PR-720/115/tests) the gpu testing is failing on Jenkins with

```
unknown file
C++ exception with description "build: The OpenCL application ended with the error: 
CL_PLATFORM_NOT_FOUND_KHR" thrown in the test body.

```

The CL\_PLATFORM\_NOT\_FOUND\_KHR error means that OpenCL cannot find an appropriate platform to compile on.

1. Can you check that the AMD SDK is installed on the machine and symlinked?
2. Can you check and update the graphics card drivers on the Jenkins machine? From [here](https://support.getfluv.io/article/253-opencl-error-clplatformnotfoundkhr) that seems to be a possible issue

Another options is for us to re-enable testing the OpenCL code on the CPU, which is pretty simple.

---

<div class="post-metadata">

**Author:** ![seantalts](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/seantalts/32/32_2.png) [@seantalts](https://discourse.mc-stan.org/u/seantalts)\
**Post date:** [February 12, 2018, 2:21pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/14 "2018-02-12T14:21:02Z")

</div>

That test ran on the linux node. I thought maybe we were running the GPU tests on the Mac Pro? If this is the case, you should change the agent line to refer to `gelman-group-mac`.

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [February 12, 2018, 3:07pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/15 "2018-02-12T15:07:27Z")

</div>

I’d like to be able to test it on either, though if that’s a hassle for now no worries. I can switch it over to just run on the gelman-group-mac

---

<div class="post-metadata">

**Author:** ![seantalts](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/seantalts/32/32_2.png) [@seantalts](https://discourse.mc-stan.org/u/seantalts)\
**Post date:** [February 12, 2018, 3:20pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/16 "2018-02-12T15:20:39Z")

</div>

I forget what the testing plan was, but I’m not sure if the Linux box has a GPU.

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [February 12, 2018, 3:24pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/17 "2018-02-12T15:24:43Z")

</div>

Cool no worries we can just use the mac

---

<div class="post-metadata">

**Author:** ![seantalts](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/seantalts/32/32_2.png) [@seantalts](https://discourse.mc-stan.org/u/seantalts)\
**Post date:** [February 12, 2018, 4:15pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/18 "2018-02-12T16:15:51Z")

</div>

@bgoodri do you know if the Linux box has a GPU? Forgive me if we went over  
this already, have a lot of loose threads I’m trying to keep track of.

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [February 12, 2018, 5:07pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/19 "2018-02-12T17:07:49Z")

</div>

```
bgoodri@Stanubuntu16:~$ lspci -v | grep -F "VGA"
02:00.0 VGA compatible controller: NVIDIA Corporation GM107GL [Quadro K620] (rev a2) (prog-if 00 [VGA controller])

```

It does not, however, have a cooling system.

---

<div class="post-metadata">

**Author:** ![seantalts](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/seantalts/32/32_2.png) [@seantalts](https://discourse.mc-stan.org/u/seantalts)\
**Post date:** [February 12, 2018, 8:15pm UTC](https://discourse.mc-stan.org/t/gpu-ci-testing/2572/20 "2018-02-12T20:15:50Z")

</div>

Oh wait, I already installed the thing on the linux box. Or at least, I ran the travis script you linked to, but that just installed it for my current user and current session. What’s the appropriate way to install this for all users?

[Next page](https://discourse.mc-stan.org/t/gpu-ci-testing/2572.md?page=2)
