Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
call "%ONEAPI_ROOT%\compiler\latest\env\vars.bat"
IF %ERRORLEVEL% NEQ 0 (
echo "oneAPI compiler activation failed"
exit /b 1
)
REM conda uses %ERRORLEVEL% but FPGA scripts can set it. So it should be reseted.
set ERRORLEVEL=

set "CC=clang-cl.exe"
set "CXX=dpcpp.exe"

rmdir /S /Q build_cmake
mkdir build_cmake
cd build_cmake

set "DPCPP_ROOT=%ONEAPI_ROOT%\compiler\latest\windows"
set "INSTALL_PREFIX=%cd%\..\install"

rmdir /S /Q "%INSTALL_PREFIX%"

cmake -G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
"-DCMAKE_INSTALL_PREFIX=%INSTALL_PREFIX%" ^
"-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX%" ^
"-DDPCPP_ROOT=%DPCPP_ROOT%" ^
"%SRC_DIR%\backends"
IF %ERRORLEVEL% NEQ 0 exit /b 1

ninja -n
ninja install
IF %ERRORLEVEL% NEQ 0 exit /b 1

cd ..
xcopy install\lib\*.lib dpctl /E /Y
xcopy install\bin\*.dll dpctl /E /Y

mkdir dpctl\include
xcopy backends\include dpctl\include /E /Y
@REM call "%ONEAPI_ROOT%\compiler\latest\env\vars.bat"
@REM IF %ERRORLEVEL% NEQ 0 (
@REM echo "oneAPI compiler activation failed"
@REM exit /b 1
@REM )
@REM REM conda uses %ERRORLEVEL% but FPGA scripts can set it. So it should be reseted.
@REM set ERRORLEVEL=

@REM set "CC=clang-cl.exe"
@REM set "CXX=dpcpp.exe"

@REM rmdir /S /Q build_cmake
@REM mkdir build_cmake
@REM cd build_cmake

@REM set "DPCPP_ROOT=%ONEAPI_ROOT%\compiler\latest\windows"
@REM set "INSTALL_PREFIX=%cd%\..\install"

@REM rmdir /S /Q "%INSTALL_PREFIX%"

@REM cmake -G Ninja ^
@REM -DCMAKE_BUILD_TYPE=Release ^
@REM "-DCMAKE_INSTALL_PREFIX=%INSTALL_PREFIX%" ^
@REM "-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX%" ^
@REM "-DDPCPP_ROOT=%DPCPP_ROOT%" ^
@REM "%SRC_DIR%\backends"
@REM IF %ERRORLEVEL% NEQ 0 exit /b 1

@REM ninja -n
@REM ninja install
@REM IF %ERRORLEVEL% NEQ 0 exit /b 1

@REM cd ..
@REM xcopy install\lib\*.lib dpctl /E /Y
@REM xcopy install\bin\*.dll dpctl /E /Y

@REM mkdir dpctl\include
@REM xcopy backends\include dpctl\include /E /Y
Comment thread
PokhodenkoSA marked this conversation as resolved.
Outdated


REM required by _sycl_core(dpctl)
Expand Down
76 changes: 38 additions & 38 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
#!/bin/bash

# We need dpcpp to compile dppl_sycl_interface
if [ ! -z "${ONEAPI_ROOT}" ]; then
# Suppress error b/c it could fail on Ubuntu 18.04
source ${ONEAPI_ROOT}/compiler/latest/env/vars.sh || true
export CC=clang
export CXX=clang++
else
echo "DPCPP is needed to build DPPL. Abort!"
exit 1
fi

rm -rf build_cmake
mkdir build_cmake
pushd build_cmake

INSTALL_PREFIX=`pwd`/../install
rm -rf ${INSTALL_PREFIX}

PYTHON_INC=`${PYTHON} -c "import distutils.sysconfig; \
print(distutils.sysconfig.get_python_inc())"`
NUMPY_INC=`${PYTHON} -c "import numpy; print(numpy.get_include())"`
DPCPP_ROOT=${ONEAPI_ROOT}/compiler/latest/linux/

cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
-DDPCPP_ROOT=${DPCPP_ROOT} \
-DPYTHON_INCLUDE_DIR=${PYTHON_INC} \
-DNUMPY_INCLUDE_DIR=${NUMPY_INC} \
../backends

make -j 4 && make install

popd
cp install/lib/*.so dpctl/

mkdir -p dpctl/include
cp -r backends/include/* dpctl/include
# if [ ! -z "${ONEAPI_ROOT}" ]; then
# # Suppress error b/c it could fail on Ubuntu 18.04
# source ${ONEAPI_ROOT}/compiler/latest/env/vars.sh || true
# export CC=clang
# export CXX=clang++
# else
# echo "DPCPP is needed to build DPPL. Abort!"
# exit 1
# fi

# rm -rf build_cmake
# mkdir build_cmake
# pushd build_cmake

# INSTALL_PREFIX=`pwd`/../install
# rm -rf ${INSTALL_PREFIX}

# PYTHON_INC=`${PYTHON} -c "import distutils.sysconfig; \
# print(distutils.sysconfig.get_python_inc())"`
# NUMPY_INC=`${PYTHON} -c "import numpy; print(numpy.get_include())"`
# DPCPP_ROOT=${ONEAPI_ROOT}/compiler/latest/linux/

# cmake \
# -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
# -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
# -DDPCPP_ROOT=${DPCPP_ROOT} \
# -DPYTHON_INCLUDE_DIR=${PYTHON_INC} \
# -DNUMPY_INCLUDE_DIR=${NUMPY_INC} \
# ../backends

# make -j 4 && make install

# popd
# cp install/lib/*.so dpctl/

# mkdir -p dpctl/include
# cp -r backends/include/* dpctl/include
Comment thread
PokhodenkoSA marked this conversation as resolved.
Outdated


# required by dpctl.sycl_core
Expand Down
47 changes: 47 additions & 0 deletions scripts/build_backend.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
call "%ONEAPI_ROOT%\compiler\latest\env\vars.bat"
IF %ERRORLEVEL% NEQ 0 (
echo "oneAPI compiler activation failed"
exit /b 1
)
REM conda uses %ERRORLEVEL% but FPGA scripts can set it. So it should be reseted.
set ERRORLEVEL=

set "CC=clang-cl.exe"
set "CXX=dpcpp.exe"

rmdir /S /Q build_cmake
mkdir build_cmake
cd build_cmake

set "DPCPP_ROOT=%ONEAPI_ROOT%\compiler\latest\windows"
set "INSTALL_PREFIX=%cd%\..\install"

rmdir /S /Q "%INSTALL_PREFIX%"

cmake -G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
"-DCMAKE_INSTALL_PREFIX=%INSTALL_PREFIX%" ^
"-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX%" ^
"-DDPCPP_ROOT=%DPCPP_ROOT%" ^
"%SRC_DIR%\backends"
IF %ERRORLEVEL% NEQ 0 exit /b 1

ninja -n
ninja install
IF %ERRORLEVEL% NEQ 0 exit /b 1

cd ..
xcopy install\lib\*.lib dpctl /E /Y
xcopy install\bin\*.dll dpctl /E /Y

mkdir dpctl\include
xcopy backends\include dpctl\include /E /Y


REM required by _sycl_core(dpctl)
@REM set "DPPL_SYCL_INTERFACE_LIBDIR=dpctl"
@REM set "DPPL_SYCL_INTERFACE_INCLDIR=dpctl\include"

@REM "%PYTHON%" setup.py clean --all
@REM "%PYTHON%" setup.py build install
@REM IF %ERRORLEVEL% NEQ 0 exit /b 1
53 changes: 53 additions & 0 deletions scripts/build_backend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# We need dpcpp to compile dppl_sycl_interface
if [ ! -z "${ONEAPI_ROOT}" ]; then
# Suppress error b/c it could fail on Ubuntu 18.04
source ${ONEAPI_ROOT}/compiler/latest/env/vars.sh || true
export CC=clang
export CXX=clang++
else
echo "DPCPP is needed to build DPPL. Abort!"
exit 1
fi

rm -rf build_cmake
mkdir build_cmake
pushd build_cmake

INSTALL_PREFIX=`pwd`/../install
rm -rf ${INSTALL_PREFIX}

PYTHON_INC=`${PYTHON} -c "import distutils.sysconfig; \
print(distutils.sysconfig.get_python_inc())"`
NUMPY_INC=`${PYTHON} -c "import numpy; print(numpy.get_include())"`
DPCPP_ROOT=${ONEAPI_ROOT}/compiler/latest/linux/

cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
-DDPCPP_ROOT=${DPCPP_ROOT} \
-DPYTHON_INCLUDE_DIR=${PYTHON_INC} \
-DNUMPY_INCLUDE_DIR=${NUMPY_INC} \
../backends

make -j 4 && make install

popd
cp install/lib/*.so dpctl/

mkdir -p dpctl/include
cp -r backends/include/* dpctl/include


# required by dpctl.sycl_core
# export DPPL_SYCL_INTERFACE_LIBDIR=dpctl
# export DPPL_SYCL_INTERFACE_INCLDIR=dpctl/include


# # FIXME: How to pass this using setup.py? This flags is needed when
# # dpcpp compiles the generated cpp file.
# export CFLAGS="-fPIC -O3 ${CFLAGS}"
# ${PYTHON} setup.py clean --all
# ${PYTHON} setup.py build install
29 changes: 29 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import os.path
import sys
import versioneer
import subprocess

from setuptools import setup, Extension, find_packages
from Cython.Build import cythonize
Expand All @@ -48,6 +49,26 @@
else:
assert False, sys.platform + " not supported"

if IS_LIN:
os.environ["CC"] = "clang"
os.environ["CXX"] = "clang++"
os.environ["DPCPP_ROOT"] = os.environ["ONEAPI_ROOT"] + "/compiler/latest/linux/"
os.environ["DPPL_OPENCL_INTERFACE_LIBDIR"] = "dpctl"
os.environ["DPPL_OPENCL_INTERFACE_INCLDIR"] = "dpctl/include"
os.environ["OpenCL_LIBDIR"] = os.environ["DPCPP_ROOT"] + "/lib"
os.environ["DPPL_SYCL_INTERFACE_LIBDIR"] = "dpctl"
os.environ["DPPL_SYCL_INTERFACE_INCLDIR"] = "dpctl/include"

elif IS_WIN:
os.environ["CC"] = "clang-cl.exe"
os.environ["CXX"] = "dpcpp.exe"
Comment thread
PokhodenkoSA marked this conversation as resolved.
os.environ["DPCPP_ROOT"] = "%ONEAPI_ROOT%\compiler\latest\windows"
os.environ["DPPL_OPENCL_INTERFACE_LIBDIR"] = "dpctl"
os.environ["DPPL_OPENCL_INTERFACE_INCLDIR"] = "dpctl\include"
os.environ["OpenCL_LIBDIR"] = os.environ["DPCPP_ROOT"] + "\lib"
os.environ["DPPL_SYCL_INTERFACE_LIBDIR"] = "dpctl"
os.environ["DPPL_SYCL_INTERFACE_INCLDIR"] = "dpctl\include"

dppl_sycl_interface_lib = os.environ["DPPL_SYCL_INTERFACE_LIBDIR"]
dppl_sycl_interface_include = os.environ["DPPL_SYCL_INTERFACE_INCLDIR"]
sycl_lib = os.environ["ONEAPI_ROOT"] + "\compiler\latest\windows\lib"
Expand Down Expand Up @@ -99,7 +120,15 @@ def get_suppressed_warning_flags():
return []


def build_backend():
if IS_LIN:
subprocess.check_call(["/bin/bash", "-c", "scripts/build_backend.sh"])
elif IS_WIN:
subprocess.check_call(["cmd.exe", "/c", "scripts\\build_backend.bat"])
Comment thread
PokhodenkoSA marked this conversation as resolved.
Outdated


def extensions():
build_backend()
Comment thread
PokhodenkoSA marked this conversation as resolved.
Outdated
# Security flags
eca = get_sdl_cflags()
ela = get_sdl_ldflags()
Expand Down