Unable to include a directory located in macOS Documents in program build options #526
Replies: 1 comment 1 reply
-
I suspect this is a behavior of the Apple OpenCL implementation and not something PyOpenCL can control. AFAICT, Apple has some systemwide "compilation server" process for CL, and they may have changed security settings around that server so that it's no longer able to access header code in those locations.
That's not a good comparison. Instead, use a C program like this to try and compile kernel source code that includes the header. I suspect you'll see the same behavior. Moving to Troubleshooting discussion. |
Beta Was this translation helpful? Give feedback.
-
I have a set of header files that define some inline functions that I use in several CL kernels. In the past I have been able to successfully include and retrieve these header files by supplying a compiler flag (namely
-I /path/to/headers
) to the program build (using theoptions
kwarg). At some point after updating macOS (think this may have started on Catalina, I am now on Big Sur), I am no longer able to include the headers if they are in the macOS "Documents", "Desktop", or "Downloads" folders or in an external drive. If I move the headers somewhere else (say~/
) and update the-I
flag, everything works. It's just something about these specific places it seems. I believe Apple has started controlling access to these folders, but what is interesting is that if I compile an example OpenCL program from the command line (clang -framework OpenCL -I /Users/username/Documents/include test.c
, wheretest.c
has an#include <test.h>
andtest.h
lives in /Users/username/Documents/include ), it works fine.MWE to reproduce the behavior:
conda create -y -n pyopencl-test python=3.8 && conda activate pyopencl-test
)pip install pyopencl
test.py
(see below) and replace "username" in the build optionstest.h
(see below) and place in "/Users/username/Documents/include" with appropriate "username"python test.py
(should fail)test.h
to "/Users/username/include" and update the build options intest.py
accordingly.python test.py
(should succeed)test.py
(augmented from documentation example):test.h
:Expected behavior
Program should find
test.h
and use thea_plus_b
function in the kernel. After step 5 above the build fails, claiming that it cannot findtest.h
. Once it is moved out of "Documents" and rerun (step 7) it works.Output after step 5:
Output after step 7:
Environment
<pyopencl.Device 'Intel(R) Xeon(R) W-2170B CPU @ 2.50GHz' on 'Apple' at 0xffffffff>
<pyopencl.Device 'AMD Radeon Pro Vega 64X Compute Engine' on 'Apple' at 0x1021d00>
Beta Was this translation helpful? Give feedback.
All reactions