OCL-dev / ocl-icd

OpenCL ICD Loader (free software)
BSD 2-Clause "Simplified" License
76 stars 23 forks source link

Multiple directories in OCL_ICD_VENDORS #7

Open isuruf opened 5 years ago

isuruf commented 5 years ago

I wanted to add a feature such that ocl-icd can look at multiple directories to find icds. For that I'm thinking of using OCL_ICD_VENDORS env variable with a colon separated list of directories like PATH env variable.

If you agree that this is useful, I can send a PR.

isuruf commented 5 years ago

ping

Kerilk commented 4 years ago

Thanks for the suggestion, that is something I am looking into.

Oblomov commented 3 years ago

Wouldn't this be better done in OPENCL_VENDOR_PATH instead?

isuruf commented 3 years ago

Yes, but that only supports one directory at a time.

Oblomov commented 3 years ago

Well, I meant extending OPENCL_VENDOR_PATH to become a colon (semicolon in Windows) separated list of paths.

Kerilk commented 3 years ago

I am working with the OpenCL WG to reunify the way the loaders are configured. These things take time, but I'd rather not add additional divergence at this point. This prevents me from using OPENCL_VENDOR_PATH which is not supported by the official loader.

One thing I would be open to is adding support for OCL_ICD_FILENAMES that is supported in the Khronos loader. I will also make a proposal to the WG regarding @isuruf suggestion.

baryluk commented 3 years ago

Hi. I also stumbled upon this (not for the first time). I want to have 64-bit and 32-bit icd files passed, and right now, it just blindly tries to open the file:

stat("/home/user/mesa-git/installdir/build-amd64-opt/install/etc/OpenCL/vendors/mesa.icd:/home/user/mesa-git/installdir/build-i386-opt/install/etc/OpenCL/vendors/mesa.icd", 0x7fff8e9e0150) = -1 ENOENT (No such file or directory)

At this point tho, I think it would be better to follow Khronos way and support OCL_ICD_FILENAMES exactly like they do. It would really help. Something that works in unified way in both ocl-icd and Khronos loader, and future other loaders, would be awesome.

Ashark commented 1 year ago

This OCL_ICD_FILENAMES is not supported yet? I am not able to set a specific icd file when there are several in system. According to manual, I can set a single icd file in OCL_ICD_VENDORS. Now when I try it like this: OCL_ICD_VENDORS=/etc/OpenCL/vendors/mesa.icd clinfo -l or like this: OCL_ICD_VENDORS=mesa.icd clinfo -l, then there are no any platforms detected! Is there a way to at least specify a single icd file?

The workaround I found for now is to copy the needed icd file (or a set of files) to a different directory, and specify it in OCL_ICD_VENDORS. So for example there are two amd platforms: orca and rocm. I want to be able to select any set and test how application will work with them. I create three directories in /home/andrey/ocl/ and the following tree inside:

├── orca
│   └── orca.icd
├── both
│   ├── orca.icd
│   └── roc.icd
└── roc
    └── roc.icd

and choose one of them by specifying OCL_ICD_VENDORS=/home/andrey/ocl/orca/, OCL_ICD_VENDORS=/home/andrey/ocl/both/ or OCL_ICD_VENDORS=/home/andrey/ocl/roc/. And this is not very convenient. By the way, trailing slashes are required for some reason.