Discussion:
[Rcpp-devel] OpenACC, Rcpp and RStudio on Windows
Emmanuel Hamel
2018-01-21 14:55:16 UTC
Permalink
Hi,

Hope you are all feeling good. I have a question. First, I use windows and
I want to use OpenACC. For the moment, I am able to compile GPU Cuda C code
with Microsoft visual studio and call it from a DLL in Windows. Also, I am
able to use OpenMP with the Rcpp package. Nevertheless, I want to extend
these possibilities for a project regarding dynamic hedging program for
segregated funds. Hence, I would like to know if you have any tips
regarding the use of OpenACC in Rcpp. In particular, what are the files
that I need to modify in a RStudio project in order to be able to compile
pragma commands with the OpenACC compiler? For the moment, I use the PGI
compiler.

Best regards,

Emmanuel
Dirk Eddelbuettel
2018-01-21 15:26:35 UTC
Permalink
On 21 January 2018 at 09:55, Emmanuel Hamel wrote:
| Hope you are all feeling good. I have a question. First, I use windows and

Never the easiest platform (in my very personal view).

| I want to use OpenACC. For the moment, I am able to compile GPU Cuda C code
| with Microsoft visual studio and call it from a DLL in Windows. Also, I am
| able to use OpenMP with the Rcpp package. Nevertheless, I want to extend
| these possibilities for a project regarding dynamic hedging program for
| segregated funds. Hence, I would like to know if you have any tips
| regarding the use of OpenACC in Rcpp. In particular, what are the files

I am not aware of anyone using it now. That said, it would be nice to have.

| that I need to modify in a RStudio project in order to be able to compile
| pragma commands with the OpenACC compiler? For the moment, I use the PGI
| compiler.

That puts a third constraint up. Which, in aggregate, makes it even less
likely that someone is doing this already.

A few people use Rcpp together with CUDA code. Charles has been working on
RViennaCL which is another "portable" approach for multiple backends:

https://cran.r-project.org/package=RViennaCL

He may be following up here too in a day or two.

Other than that, RcppParallel exists, is fairly widely used, and gives you
higher-level abstractions for OpenMP-style parallelism. No GPU though.

So in short if you need
- OpenACC
- on Windows
- with PGI
you may have to roll up your sleeves and build it. We will help as we can.

If it were me, I'd relax as many constraints here as possible. So how about
figuring out how to interface OpenACC on any suitable platform and compiler
pair?

Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Emmanuel Hamel
2018-01-21 15:32:09 UTC
Permalink
Hi,

Thank you for your answer! I am already able to use the OpenMP-style
without RcppParallel, thanks to some examples given in the Rcpp community.
I will have a look at the RViennaCL.

For my problem, the compiler is not important. I just mentioned the one I
use as an example. However, I really have to use Windows.

Best regards,

Emmanuel
Post by Dirk Eddelbuettel
| Hope you are all feeling good. I have a question. First, I use windows and
Never the easiest platform (in my very personal view).
| I want to use OpenACC. For the moment, I am able to compile GPU Cuda C code
| with Microsoft visual studio and call it from a DLL in Windows. Also, I am
| able to use OpenMP with the Rcpp package. Nevertheless, I want to extend
| these possibilities for a project regarding dynamic hedging program for
| segregated funds. Hence, I would like to know if you have any tips
| regarding the use of OpenACC in Rcpp. In particular, what are the files
I am not aware of anyone using it now. That said, it would be nice to have.
| that I need to modify in a RStudio project in order to be able to compile
| pragma commands with the OpenACC compiler? For the moment, I use the PGI
| compiler.
That puts a third constraint up. Which, in aggregate, makes it even less
likely that someone is doing this already.
A few people use Rcpp together with CUDA code. Charles has been working on
https://cran.r-project.org/package=RViennaCL
He may be following up here too in a day or two.
Other than that, RcppParallel exists, is fairly widely used, and gives you
higher-level abstractions for OpenMP-style parallelism. No GPU though.
So in short if you need
- OpenACC
- on Windows
- with PGI
you may have to roll up your sleeves and build it. We will help as we can.
If it were me, I'd relax as many constraints here as possible. So how about
figuring out how to interface OpenACC on any suitable platform and compiler
pair?
Dirk
--
Charles Determan
2018-01-22 15:18:29 UTC
Permalink
Hi Emmanuel,

As Dirk mentioned, I am involved in making GPU computing as portable and
accessible as possible. Depending on your needs, most functionality may
already be implemented in my gpuR package (
https://cran.r-project.org/package=gpuR). It is an OpenCL backend so it
can be installed essentially anywhere for any hardware. It also has new
functionality to accept custom, user provided OpenCL kernels to extend to
non-implemented operations. That said, I am working on setting up the CUDA
backend. I have had some success with Linux systems but trouble with
Windows. The main problem with that, as you may have discovered, is that
NVIDIA's nvcc compiler requires the use of cl.exe on Windows systems. This
prevents the normal use of Rtools mingw functions. As such, I am still
looking in to how I can create a solid configure script for Windows systems
so that cl.exe can be used instead of g++. If I can be of help, feel free
to reach out. I need a bit more dedicated time to sort out Windows but I
have been quite busy as of late.

Regards,
Charles
Post by Emmanuel Hamel
Hi,
Thank you for your answer! I am already able to use the OpenMP-style
without RcppParallel, thanks to some examples given in the Rcpp community.
I will have a look at the RViennaCL.
For my problem, the compiler is not important. I just mentioned the one I
use as an example. However, I really have to use Windows.
Best regards,
Emmanuel
Post by Dirk Eddelbuettel
| Hope you are all feeling good. I have a question. First, I use windows and
Never the easiest platform (in my very personal view).
| I want to use OpenACC. For the moment, I am able to compile GPU Cuda C code
| with Microsoft visual studio and call it from a DLL in Windows. Also, I am
| able to use OpenMP with the Rcpp package. Nevertheless, I want to extend
| these possibilities for a project regarding dynamic hedging program for
| segregated funds. Hence, I would like to know if you have any tips
| regarding the use of OpenACC in Rcpp. In particular, what are the files
I am not aware of anyone using it now. That said, it would be nice to have.
| that I need to modify in a RStudio project in order to be able to compile
| pragma commands with the OpenACC compiler? For the moment, I use the PGI
| compiler.
That puts a third constraint up. Which, in aggregate, makes it even less
likely that someone is doing this already.
A few people use Rcpp together with CUDA code. Charles has been working on
https://cran.r-project.org/package=RViennaCL
He may be following up here too in a day or two.
Other than that, RcppParallel exists, is fairly widely used, and gives you
higher-level abstractions for OpenMP-style parallelism. No GPU though.
So in short if you need
- OpenACC
- on Windows
- with PGI
you may have to roll up your sleeves and build it. We will help as we can.
If it were me, I'd relax as many constraints here as possible. So how about
figuring out how to interface OpenACC on any suitable platform and compiler
pair?
Dirk
--
_______________________________________________
Rcpp-devel mailing list
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Emmanuel Hamel
2018-01-23 03:59:06 UTC
Permalink
Hi,

First, I would like to say thank you because you spend time answering my
questions and you are not paid. I appreciate a lot. I will take a look more
seriously at OpenCL. I am mainly interested in "non-implemented
operations". I also think that the problem is related to the fact that it
is "difficult" to make a link between Rtools and nvcc compiler. I have
looked at many R packages for GPU and a lot of them do not seem available
on windows. Finally, If you find the solution of how to integrate easily
OpenACC and Rtools in the future, let me know. I think it would be great to
have a "RcppOpenACC" package. This would enable developers to create
flexible code in C++ (CPU and GPU at the same time!).

Best regards,

Emmanuel
Post by Charles Determan
Hi Emmanuel,
As Dirk mentioned, I am involved in making GPU computing as portable and
accessible as possible. Depending on your needs, most functionality may
already be implemented in my gpuR package (https://cran.r-project.org/
package=gpuR). It is an OpenCL backend so it can be installed
essentially anywhere for any hardware. It also has new functionality to
accept custom, user provided OpenCL kernels to extend to non-implemented
operations. That said, I am working on setting up the CUDA backend. I
have had some success with Linux systems but trouble with Windows. The
main problem with that, as you may have discovered, is that NVIDIA's nvcc
compiler requires the use of cl.exe on Windows systems. This prevents the
normal use of Rtools mingw functions. As such, I am still looking in to
how I can create a solid configure script for Windows systems so that
cl.exe can be used instead of g++. If I can be of help, feel free to reach
out. I need a bit more dedicated time to sort out Windows but I have been
quite busy as of late.
Regards,
Charles
Post by Emmanuel Hamel
Hi,
Thank you for your answer! I am already able to use the OpenMP-style
without RcppParallel, thanks to some examples given in the Rcpp community.
I will have a look at the RViennaCL.
For my problem, the compiler is not important. I just mentioned the one I
use as an example. However, I really have to use Windows.
Best regards,
Emmanuel
Post by Dirk Eddelbuettel
| Hope you are all feeling good. I have a question. First, I use windows and
Never the easiest platform (in my very personal view).
| I want to use OpenACC. For the moment, I am able to compile GPU Cuda C code
| with Microsoft visual studio and call it from a DLL in Windows. Also, I am
| able to use OpenMP with the Rcpp package. Nevertheless, I want to extend
| these possibilities for a project regarding dynamic hedging program for
| segregated funds. Hence, I would like to know if you have any tips
| regarding the use of OpenACC in Rcpp. In particular, what are the files
I am not aware of anyone using it now. That said, it would be nice to have.
| that I need to modify in a RStudio project in order to be able to compile
| pragma commands with the OpenACC compiler? For the moment, I use the PGI
| compiler.
That puts a third constraint up. Which, in aggregate, makes it even less
likely that someone is doing this already.
A few people use Rcpp together with CUDA code. Charles has been working on
https://cran.r-project.org/package=RViennaCL
He may be following up here too in a day or two.
Other than that, RcppParallel exists, is fairly widely used, and gives you
higher-level abstractions for OpenMP-style parallelism. No GPU though.
So in short if you need
- OpenACC
- on Windows
- with PGI
you may have to roll up your sleeves and build it. We will help as we can.
If it were me, I'd relax as many constraints here as possible. So how about
figuring out how to interface OpenACC on any suitable platform and compiler
pair?
Dirk
--
_______________________________________________
Rcpp-devel mailing list
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Dirk Eddelbuettel
2018-01-23 04:19:06 UTC
Permalink
On 22 January 2018 at 22:59, Emmanuel Hamel wrote:
| First, I would like to say thank you because you spend time answering my
| questions and you are not paid. I appreciate a lot. I will take a look more
| seriously at OpenCL. I am mainly interested in "non-implemented
| operations". I also think that the problem is related to the fact that it
| is "difficult" to make a link between Rtools and nvcc compiler. I have
| looked at many R packages for GPU and a lot of them do not seem available
| on windows. Finally, If you find the solution of how to integrate easily

The Windows toolchain issue is a problem. We are fixed at g++-4.9.3 for some
time.

| OpenACC and Rtools in the future, let me know. I think it would be great to
| have a "RcppOpenACC" package. This would enable developers to create
| flexible code in C++ (CPU and GPU at the same time!).

I looked a little at OpenACC after you first asked as the topic seems
interesting. From my casual browsing it seems my machine (where g++ is
g++-7.2 here on Ubuntu 7.10) already has it -- newer g++ included it.

On Windows you will be constrained. Maybe at some point with a newer Windows
10 you can cheat and use the Windows Subsystem for Linux (or whatever it is
called). In the meantime, just use AWS, a cheap laptop, or some other means.
It is good technology -- use it, make a business case and use that to get
your corporate windows-only constraint relaxed. At least one can hope...

Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Emmanuel Hamel
2018-01-23 04:24:34 UTC
Permalink
Hi,

For the moment, I compile the GPU code with Visual studio 2015 to make à
DLL, and then I call it from R. It is the only solution I found for the
moment.

Best regards,

Emmanuel
Post by Dirk Eddelbuettel
| First, I would like to say thank you because you spend time answering my
| questions and you are not paid. I appreciate a lot. I will take a look more
| seriously at OpenCL. I am mainly interested in "non-implemented
| operations". I also think that the problem is related to the fact that it
| is "difficult" to make a link between Rtools and nvcc compiler. I have
| looked at many R packages for GPU and a lot of them do not seem available
| on windows. Finally, If you find the solution of how to integrate easily
The Windows toolchain issue is a problem. We are fixed at g++-4.9.3 for some
time.
| OpenACC and Rtools in the future, let me know. I think it would be great to
| have a "RcppOpenACC" package. This would enable developers to create
| flexible code in C++ (CPU and GPU at the same time!).
I looked a little at OpenACC after you first asked as the topic seems
interesting. From my casual browsing it seems my machine (where g++ is
g++-7.2 here on Ubuntu 7.10) already has it -- newer g++ included it.
On Windows you will be constrained. Maybe at some point with a newer Windows
10 you can cheat and use the Windows Subsystem for Linux (or whatever it is
called). In the meantime, just use AWS, a cheap laptop, or some other means.
It is good technology -- use it, make a business case and use that to get
your corporate windows-only constraint relaxed. At least one can hope...
Dirk
--
Qiang Kou
2018-01-23 16:28:56 UTC
Permalink
Post by Emmanuel Hamel
For the moment, I compile the GPU code with Visual studio 2015 to make à
DLL, and then I call it from R. It is the only solution I found for the
moment.
In MXNet R package, we also compile the cuda code using visual studio to
generate the dll.

This is the easiest way I know.

Best,

KK
Emmanuel Hamel
2018-01-23 17:10:19 UTC
Permalink
Here is a message that I received that was not in the "email chain" ...


Hi Emmanuel. Probably you take a look to the approach taken by Microsoft
in LightGBM R package. I do not know details (so approach could be
irrelevant to what you've asked), but on windows they build package (even
with gpu support) using Visual Studio toolchain. You can check here -
https://github.com/Microsoft/LightGBM/tree/master/R-package.

If you will find it useful please report back to this mailing list, so we
will be aware of it. Thanks.
Send Rcpp-devel mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo
/rcpp-devel
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Rcpp-devel digest..."
Post by Emmanuel Hamel
For the moment, I compile the GPU code with Visual studio 2015 to make à
DLL, and then I call it from R. It is the only solution I found for the
moment.
In MXNet R package, we also compile the cuda code using visual studio to
generate the dll.
This is the easiest way I know.
Best,
KK
Charles Determan
2018-02-07 16:21:57 UTC
Permalink
It is worth noting on this thread that the LightGBM package actually
doesn't have a CUDA backend for Windows. It requires an OpenCL SDK as
noted here (https://github.com/Microsoft/LightGBM/issues/1236).

Regards,
Charles
Post by Emmanuel Hamel
Here is a message that I received that was not in the "email chain" ...
Hi Emmanuel. Probably you take a look to the approach taken by Microsoft
in LightGBM R package. I do not know details (so approach could be
irrelevant to what you've asked), but on windows they build package (even
with gpu support) using Visual Studio toolchain. You can check here -
https://github.com/Microsoft/LightGBM/tree/master/R-package.
If you will find it useful please report back to this mailing list, so we
will be aware of it. Thanks.
Send Rcpp-devel mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo
/rcpp-devel
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Rcpp-devel digest..."
Post by Emmanuel Hamel
For the moment, I compile the GPU code with Visual studio 2015 to make à
DLL, and then I call it from R. It is the only solution I found for the
moment.
In MXNet R package, we also compile the cuda code using visual studio to
generate the dll.
This is the easiest way I know.
Best,
KK
_______________________________________________
Rcpp-devel mailing list
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Loading...