CNugteren / CLBlast

Tuned OpenCL BLAS
Apache License 2.0
1.06k stars 202 forks source link

Python module mutli-platform setup #519

Closed vathomass closed 10 months ago

vathomass commented 11 months ago

Hi,

There were three issues when installing pyclblast in windows:

  1. To compile the python module, you should provide to the linker the clblast and opencl include paths and the clblast library path. If not the module will not compile.
  2. The runtime_library_dirs options in distutils.extension.Extension, used by the setup.py script, is not available in windows platforms (see here).
  3. After a successful install, you get an ImportError: DLL load failed message when trying to import the module. This is probably related to this issue.

This PR moves towards installing pyclblast in windows, without breaking the installation on others platforms. The CLBlast library uses cmake for building and installing, and also installs a cmake package for the library. Using cmake for building the python module also should address issues 1 and 2 (let cmake take care of finding the clblast installation and setting up the compiler and linker flags). To solve issue 3, one approach (found in the internet) is to copy the dll along with the binary module to the installation folder.

Moreover, the PR switched from the setup.py style to the pyproject.toml style installation, hopefully for good.

I am a basic user of cmake, so I welcome any comments. I have tested the changes on windows and linux environments.

Best, Thomas

vathomass commented 10 months ago

Hi,

I have also switched to scikit-build-core for building the bindings, a module that uses CMake for building python packages. I assume it is better than the custom code I had added in the setup.py file.

Best Thomas