-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenCL exception on Mac #85
Comments
Not sure what is causing this, but @smistad can likely aid you further. Assuming that OpenCL is properly setup, it could be that you have the same issue as I did on my macbook. It is an older macbook (non-silicon). On my macbook I have two GPUs: one AMD GPU and one integrated Intel GPU. For whatever reason, when using the AMD GPU I got a similar error as you got above. After switching to use the Intel GPU, the problem was resolved. By default, the best GPU will be selected by the OS. In order to force the OS to use the Intel GPU, which should be compatible with FP, I used a program called gfxCardStatus. After installing it, you can choose to toggle between GPUs from the top bar. "Dynamic switching" should be enabled by default, but if you set "Integrated only" it should use the integrated GPU which should be compatible with FP. See example below. Note that you cannot have a monitor connected to the macbook when using the "Integrated only" option. BTW: If I remember correctly, I was able to render the WSI using the AMD GPU, but running any analysis, even tissue segmentation, resulted in the same error as you had. Are you able to render the WSI? |
I did not have the same issue on my macbook, also running Monterey (v12 macOS). As this seems OpenCL-related, @smistad can likely assist you further. Also, I assume you get the same for all pipelines, including the simple tissue segmenter? |
Yes I can confirm that (when I could add images) I had the issue with all pipelines. |
Not sure I can be of much help with OpenCL-issues, but what do you get when you run |
Here is the output of clinfo:
|
I removed all FAST and fastpathology files from my home folder and restarted a new project. Now I am back to the original error. It seems as if the error always comes after dilation:
But I don't see any |
Just ran I also tried to reinstall FP using the very latest release, but I could not reproduce this issue. Also could you try running fastpathology with verbose enabled, unless that was already the case, like so:
|
Thanks for spending some time on this! |
Very strange. I'm have no idea what is causing this. Debugging is also challenging as I cannot reproduce the issue myself, but it is apparent that something is not working, as you have observed the same bug on two separate machines. I will assign @smistad to this issue. He is likely off for the weekend, but may reply early next week. |
Lastly, could you check that |
I just ran a small test where I deleted both the After forcing the OS to use the integrated GPU instead, it worked fine. So I do not think there is necessarily a FAST-bug, but rather that for whatever reason your CPU-GPU setup is not working as it should. Perhaps there could be an OpenCL-OpenGL interop issue. Could you show me the verbose you get from launching FastPathology from the terminal (with |
Unfortunately I am also out for the weekend with no access to the Mac computer. Will test on Monday! Thanks again |
Hi OpenCL is installed correctly, apple has their own implementation which is always installed. The error comes from apple's opencl failing to compile some OpenCL code. I think it fails to compile erosion.cl https://github.com/smistad/FAST/blob/master/source/FAST/Algorithms/Morphology/Erosion.cl Also I think this is the same issue we have seen on AMD Macs. This can probably be resolved by rewriting the code it fails on. You can try editing the erosion.cl file yourself. It will try to recompile every time you run it. To fix it myself I need access to a Mac with this issue. |
Hi @smistad, Apparently, Mac OS doesn't like having
Don't ask me why 🤷 I will do some more testing to see if something else needs fixing. |
The Apple OpenCL compiler is not completely stable.. Let us know if you find more of these compile issues and we can add the fixes to FAST |
Once fixing the missing new line in ImageFill.cl, I didn't get any other compilation errors. I tested a couple of pipelines, and they worked well. (Edit: I see you wrote that TissueSegmentation uses Erosion.cl, but I had no issue with it. So probably means it's only in ImageFill.cl for some reason.) |
Doh! 🤦 I added a fix for it to FAST just now: smistad/FAST@167f5cb Thanks for figuring this out @cavenel @andreped Could you test if this was the cause for crashes on AMD Mac's as well? |
This build should contain the fix: https://github.com/AICAN-Research/FAST-Pathology/actions/runs/6072324757 |
@cavenel Could you verify that the latest release of FP (v1.1.2) works out-of-the-box on your macbook? |
Yes I can confirm in now works out-of-the-box with version 1.1.2! Thanks for the fast fix! Will you also add the arm64 asset? |
Yes, I will compile it for arm64 as well, but I have to do it manually still since github doesn't offer arm64 macOS runners yet |
@cavenel I just uploaded an macos arm64 package to the release. I haven't been able to test it my self, so let me know if it doesn't work for some reason. |
Not sure yet. I never tested on M1 before, but now I get stuck at launch, it can not find libomp.dynlib:
I did install libomp from homebrew:
and libomp.dylib is in
I wonder if that's because fastpathology is looking for v14.0.6 specifically and homebrew installed 16.0.6 instead. |
@cavenel This is related to issue #73 Basically, we do not yet bundle these dependencies as part of FastPathology. These are installed separately, and thus if these gets updated, then FP might no longer work. @smistad should known which versions of these dependencies you should install, and then reinstalling (downgrading/upgrading) should resolve the issue. There are likely other deps that could have issues, but for this specific dependency, you could try running:
If this exact formula is not available, try another version |
Unfortunately, libomp 16.0.6 seems to be the only available version in brew for arm64. |
Yes, brew is very annyoing; suddenly updating packages, and then not supporting installation of older versions. |
The arm64 build I uploaded was built with libomp 16.0.6. The x86_64 version build is with v14 of libomp. |
But then the error message @cavenel gets for M1 doesn't make sense, as it looks like FP expects
|
You are right, my bad its version 14... We need to start bundling these dependencies to get out of this dependency hell on mac |
I fixed it for now with:
Which is kind of ugly and might crash if the two versions differ too much. |
PS: I have an other project using openslide and qt6, and I would really like to have an installer for Mac as we already have one for windows. So if you manage to bundle all dependencies and make a dmg out of it that would be really interesting for me too :-D |
Hi,
Not sure if it is an issue with FASTPathology or a problem with the installation of openCL, but I have a user that got these error message after following all the installation steps on Mac OS:
And the terminal shows:
Is there any way to check if OpenCL is installed properly on MacOS?
The text was updated successfully, but these errors were encountered: