Skip to content

Update ci.yml #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 15, 2024
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
IMEX_CACHE_NUMBER: 4 # Increase to reset cache
jobs:
build_and_test:
runs-on: tpi-ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions: read-all

jobs:
pre-commit:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v5
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-ast
- id: check-builtin-literals
Expand All @@ -19,13 +19,13 @@ repos:
- id: trailing-whitespace
exclude: '.*\.patch'
- repo: https://github.com/psf/black
rev: 23.12.0
rev: 24.3.0
hooks:
- id: black
args: ["--line-length", "80"]
language_version: python3
- repo: https://github.com/PyCQA/bandit
rev: '1.7.7'
rev: '1.7.8'
hooks:
- id: bandit
args: ["-c", ".bandit.yml"]
Expand All @@ -35,7 +35,7 @@ repos:
- id: isort
name: isort (python)
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pocc/pre-commit-hooks
Expand Down
42 changes: 27 additions & 15 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,28 @@ popd

# skip checkout/build of IMEX/LLVM if there is an install
if [ ! -d "${INSTALLED_DIR}/imex/lib" ]; then
# FIXME work-around as long dpcpp conda packages are incomplete
export SYCL_DIR="/opt/intel/oneapi/compiler/latest/linux"
if [ ! -d "${SYCL_DIR}" ]; then
export SYCL_DIR="/opt/intel/oneapi/compiler/latest"
if [ ! -d "${SYCL_DIR}" ]; then
echo "Fatal error: SYCL_DIR not found"
exit 1
fi
fi
# export SYCL_DIR=${CONDA_PREFIX}
echo "Using SYCLDIR=${SYCL_DIR}"
export SYCL_DIR=${CONDA_PREFIX}
echo "Using SYCL_DIR=${SYCL_DIR}"

# grrrr
# as long as the conda packages differ from system oneAPI installs we need to explicitly provide the include dir for SYCL
# see also below in cmake call
# for root in "${CONDA_PREFIX}" "${BUILD_PREFIX}"; do
# spirvdir=$(find "${root}" -type d -name __spirv | head -n 1)
# if [ -d "${spirvdir}" ]; then
# SPIRV_INC_DIR=$(dirname "${spirvdir}")
# break
# fi
# done
# if [ -d "${SPIRV_INC_DIR}" ]; then
# echo "Using SPIRV_INC_DIR=${SPIRV_INC_DIR}"
# mkdir -p "${SRC_DIR}/grrrr/include"
# ln -s "${SPIRV_INC_DIR}" "${SRC_DIR}/grrrr/include/CL"
# SPIRV_INC_DIR="${SRC_DIR}/grrrr/include"
# else
# echo "Fatal error: SPIRV_INC_DIR not found"
# exit 1
# fi
Comment on lines +33 to +51
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm comments?


rm -rf ${INSTALLED_DIR}/imex
IMEX_SHA=$(cat imex_version.txt)
Expand Down Expand Up @@ -83,10 +94,11 @@ if [ ! -d "${INSTALLED_DIR}/imex/lib" ]; then
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_EXTERNAL_PROJECTS="Imex" \
-DLLVM_EXTERNAL_IMEX_SOURCE_DIR=. \
-DLEVEL_ZERO_DIR=${INSTALLED_DIR}/level-zero \
-DIMEX_ENABLE_SYCL_RUNTIME=1 \
-DIMEX_ENABLE_L0_RUNTIME=1
-DLLVM_EXTERNAL_IMEX_SOURCE_DIR=.
# -DLEVEL_ZERO_DIR=${INSTALLED_DIR}/level-zero \
# -DIMEX_ENABLE_SYCL_RUNTIME=1 \
# -DIMEX_ENABLE_L0_RUNTIME=1 \
# -DCMAKE_CXX_FLAGS="-I${SPIRV_INC_DIR}" # grrrr
Comment on lines +98 to +101
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind I'll keep the comments for later when we enable oneAPI/devices.

cmake --build build
cmake --install build --prefix=${INSTALLED_DIR}/imex
popd
Expand Down
7 changes: 4 additions & 3 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ requirements:

build:
- {{compiler('gxx')}}
- sysroot_linux-64 >=2.28 # [linux]
# - dpcpp_linux-64 # [linux]
# - dpcpp_win-64 # [win]
- sysroot_linux-64 # [linux]
# - sysroot_linux-64 >=2.28 # [linux]
- dpcpp_linux-64 >=2024.1 # [linux]
- dpcpp_win-64 # [win]
# - {{compiler('dpcpp')}} >={{required_compiler_and_mkl_version}},!={{excluded_compiler_version1}},!={{excluded_compiler_version2}} # [not osx]
run:
- numpy x.x
Expand Down
1 change: 1 addition & 0 deletions examples/black_scholes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
python black_scholes.py -p M16Gb -b numpy

"""

import argparse
import os
import time as time_mod
Expand Down
1 change: 1 addition & 0 deletions examples/shallow_water.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
python shallow_water.py -b numpy ...

"""

import argparse
import math
import os
Expand Down
1 change: 1 addition & 0 deletions examples/wave_equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
python wave_equation.py -b numpy ...

"""

import argparse
import math
import os
Expand Down
1 change: 1 addition & 0 deletions sharpy/array_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
distributed implementation of the array API as defined here:
https://data-apis.org/array-api/latest
"""

from collections import OrderedDict

api_categories = OrderedDict(
Expand Down
1 change: 1 addition & 0 deletions sharpy/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
The array class for sharpy, a distributed implementation of the
array API as defined here: https://data-apis.org/array-api/latest
"""

#
# See __init__.py for an implementation overview
#
Expand Down
2 changes: 1 addition & 1 deletion src/LinAlgOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

#include <mpi.h>
//#include <mkl.h>
// #include <mkl.h>
#include "sharpy/Factory.hpp"
#include "sharpy/LinAlgOp.hpp"
#include "sharpy/NDArray.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/_sharpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void init(bool cw, const std::string &libidtr) {
VT(VT_begin, vtWaitSym); \
py::gil_scoped_release release; \
Service::run(); \
auto r = (_f).get().get() -> _a(); \
auto r = (_f).get().get()->_a(); \
VT(VT_end, vtWaitSym); \
return r

Expand Down
44 changes: 11 additions & 33 deletions src/include/sharpy/CppTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,39 +63,17 @@ enum _RANKS : rank_type {
};

template <typename T> struct DTYPE {};
template <> struct DTYPE<double> {
constexpr static DTypeId value = FLOAT64;
};
template <> struct DTYPE<float> {
constexpr static DTypeId value = FLOAT32;
};
template <> struct DTYPE<int64_t> {
constexpr static DTypeId value = INT64;
};
template <> struct DTYPE<int32_t> {
constexpr static DTypeId value = INT32;
};
template <> struct DTYPE<int16_t> {
constexpr static DTypeId value = INT16;
};
template <> struct DTYPE<int8_t> {
constexpr static DTypeId value = INT8;
};
template <> struct DTYPE<uint64_t> {
constexpr static DTypeId value = UINT64;
};
template <> struct DTYPE<uint32_t> {
constexpr static DTypeId value = UINT32;
};
template <> struct DTYPE<uint16_t> {
constexpr static DTypeId value = UINT16;
};
template <> struct DTYPE<uint8_t> {
constexpr static DTypeId value = UINT8;
};
template <> struct DTYPE<bool> {
constexpr static DTypeId value = BOOL;
};
template <> struct DTYPE<double> { constexpr static DTypeId value = FLOAT64; };
template <> struct DTYPE<float> { constexpr static DTypeId value = FLOAT32; };
template <> struct DTYPE<int64_t> { constexpr static DTypeId value = INT64; };
template <> struct DTYPE<int32_t> { constexpr static DTypeId value = INT32; };
template <> struct DTYPE<int16_t> { constexpr static DTypeId value = INT16; };
template <> struct DTYPE<int8_t> { constexpr static DTypeId value = INT8; };
template <> struct DTYPE<uint64_t> { constexpr static DTypeId value = UINT64; };
template <> struct DTYPE<uint32_t> { constexpr static DTypeId value = UINT32; };
template <> struct DTYPE<uint16_t> { constexpr static DTypeId value = UINT16; };
template <> struct DTYPE<uint8_t> { constexpr static DTypeId value = UINT8; };
template <> struct DTYPE<bool> { constexpr static DTypeId value = BOOL; };

template <DTypeId DT> struct TYPE {};
template <> struct TYPE<FLOAT64> {
Expand Down
2 changes: 1 addition & 1 deletion test/test_spmd.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
import pytest
from mpi4py import MPI
from utils import device

import sharpy as sp
from mpi4py import MPI
from sharpy import _sharpy_cw


Expand Down
Loading