conda-forge / intel-compiler-repack-feedstock

A conda-smithy repository for intel-compiler-repack.
BSD 3-Clause "New" or "Revised" License
3 stars 7 forks source link

recipe: scripts: set INCLUDE and LIB on Windows #25

Closed igorsafo closed 2 months ago

igorsafo commented 9 months ago

Checklist

In the current version of the compiler package on Windows when user activates an environment with dpcpp compiler and tries to build an application or a library the following issues happen:

(dpcpp) C:\Users\igorsafo\Workspace\libraries.performance.math.onednn-master\build>cmake -DDNNL_CPU_RUNTIME=DPCPP   -DDNNL_GPU_RUNTIME=DPCPP -GNinja ..
-- The CXX compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Users/igorsafo/AppData/Local/miniconda3/envs/dpcpp/Library/bin/icx.exe
-- Check for working CXX compiler: C:/Users/igorsafo/AppData/Local/miniconda3/envs/dpcpp/Library/bin/icx.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "C:/Users/igorsafo/AppData/Local/miniconda3/envs/dpcpp/Library/bin/icx.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/igorsafo/Workspace/libraries.performance.math.onednn-master/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/Users/igorsafo/AppData/Local/miniconda3/envs/dpcpp/Library/bin/ninja.exe cmTC_56ae9 && [1/2] Building CXX object CMakeFiles\cmTC_56ae9.dir\testCXXCompiler.cxx.obj
    [2/2] Linking CXX executable cmTC_56ae9.exe
    FAILED: cmTC_56ae9.exe
    cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_56ae9.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x86\mt.exe --manifests  -- C:\Users\igorsafo\AppData\Local\miniconda3\envs\dpcpp\Library\bin\icx.exe /nologo CMakeFiles\cmTC_56ae9.dir\testCXXCompiler.cxx.obj  /link /out:cmTC_56ae9.exe /implib:cmTC_56ae9.lib /pdb:cmTC_56ae9.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
    LINK Pass 1: command "C:\Users\igorsafo\AppData\Local\miniconda3\envs\dpcpp\Library\bin\icx.exe /nologo CMakeFiles\cmTC_56ae9.dir\testCXXCompiler.cxx.obj /link /out:cmTC_56ae9.exe /implib:cmTC_56ae9.lib /pdb:cmTC_56ae9.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_56ae9.dir/intermediate.manifest CMakeFiles\cmTC_56ae9.dir/manifest.res" failed (exit code 1104) with the following output:
    LINK : fatal error LNK1104: cannot open file 'libircmt.lib'
    icx: error: linker command failed with exit code 1104 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

In file included from simple.cpp:1: C:\Users\igorsafo\AppData\Local\miniconda3\envs\dpcpp\Library\lib\clang\17\include\CL/sycl.hpp(11,10): fatal error: 'sycl/sycl.hpp' file not found

include <sycl/sycl.hpp>

     ^~~~~~~~~~~~~~~

1 error generated.


Extending `INCLUDE` with `%CONDA_PREFIX%\include` fixes the second issue.

This change makes the activation kind of similar to `setvars.bat` distributed with compiler as part of oneAPI package. It makes the complier ready to be used out of box. If we keep activation as is:
- Each application that uses the compiler should set environment which might change once the compiler version changes.
- The behavior is inconsistent with other compilers, usually once you setup a compiler it sets everything and there is no need to do anything manually.

An alternative solution might be a `setvars.sh` & `setvars.bat` that will be distributed with the compiler package so any user can call it to setup the environment.

This should fix the issues in https://github.com/conda-forge/onednn-feedstock/pull/53 on Windows

+@isuruf
conda-forge-webservices[bot] commented 9 months ago

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipe) and found some lint.

Here's what I've got...

For recipe:

igorsafo commented 9 months ago

@conda-forge-admin, please rerender

oleksandr-pavlyk commented 9 months ago

@igorsafo These changes in activation script just work around a problem that should really be fixed in intel::dpcpp_win-64.

We have to do this in dpctl's build script: https://github.com/IntelPython/dpctl/blob/master/conda-recipe/bld.bat#L3-L4

The fix for this is that %PREFIX%\include% folder in intel::dpcpp_impl_win-64 should really have been placed in %PREFIX%\Library\include, ref: https://github.com/conda-forge/intel-compiler-repack-feedstock/pull/4#discussion_r960084632

Something along this lines would resolve the need to set LIB variable, e.g. %PREFIX%\compiler\lib be installed into %PREFIX%\Library\lib, but I am less sure about this.

Such layout reshuffling could be done during repackaging by conda-forge, for example.

igorsafo commented 9 months ago

@igorsafo These changes in activation script just work around a problem that should really be fixed in intel::dpcpp_win-64.

We have to do this in dpctl's build script: https://github.com/IntelPython/dpctl/blob/master/conda-recipe/bld.bat#L3-L4

The fix for this is that %PREFIX%\include% folder in intel::dpcpp_impl_win-64 should really have been placed in %PREFIX%\Library\include, ref: #4 (comment)

Something along this lines would resolve the need to set LIB variable, e.g. %PREFIX%\compiler\lib be installed into %PREFIX%\Library\lib, but I am less sure about this.

Such layout reshuffling could be done during repackaging by conda-forge, for example.

Thanks for the explanation. Will you be able to fix the issue on intel::dpcpp_win-64 side?