diff --git a/README.md b/README.md index bf9dfd5ff27e..a26125fa35fe 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,35 @@ DPNP_QUEUE_GPU=1 python examples/example1.py ``` ## Build from source: + Ensure you have the following prerequisite packages installed: + +- `mkl-devel-dpcpp` +- `dpcpp_linux-64` or `dpcpp_win-64` (depending on your OS) +- `tbb-devel` +- `dpctl` + +In addition, you need oneDPL installed on your system. There are two ways to do +so: + +1. Install oneAPI and run the oneDPL activation script. E.g., on linux: + + ```bash + source /opt/intel/oneapi/dpl/latest/env/vars.sh + ``` + +2. Clone dpl from https://github.com/oneapi-src/oneDPL and set the `DPL_ROOT` + environment variable to point to the `include` directory in the repository. + + E.g., on linux + + ```bash + git clone https://github.com/oneapi-src/oneDPL + export DPL_ROOT=$(pwd)/oneDPL/include + ``` + +After these steps, `dpnp` can be built in debug mode as follows: + + ```bash git clone https://github.com/IntelPython/dpnp cd dpnp diff --git a/dpnp/__init__.py b/dpnp/__init__.py index 843c3c111a6b..5fbe1f05864d 100644 --- a/dpnp/__init__.py +++ b/dpnp/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # ***************************************************************************** -# Copyright (c) 2016-2020, Intel Corporation +# Copyright (c) 2016-2022, Intel Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -30,7 +30,16 @@ import dpctl dpctlpath = os.path.dirname(dpctl.__file__) -os.environ["PATH"] += os.pathsep + mypath + os.pathsep + dpctlpath +# For Windows OS with Python >= 3.7, it is required to explicitly define a path +# where to search for DLLs towards both DPNP backend and DPCTL Sycl interface, +# otherwise DPNP import will be failing. This is because the libraries +# are not installed under any of default paths where Python is searching. +from platform import system +if system() == 'Windows': + if hasattr(os, "add_dll_directory"): + os.add_dll_directory(mypath) + os.add_dll_directory(dpctlpath) + os.environ["PATH"] = os.pathsep.join([os.getenv("PATH", ""), mypath, dpctlpath]) from dpnp.dpnp_array import dpnp_array as ndarray