Skip to content

Commit

Permalink
Improve compilation error handling (#55)
Browse files Browse the repository at this point in the history
* Add check on backend compilation exit status

* Update package version

* Run compilation as subprocess

* Remove debug compilation warnings

* Update package version

* Fix installation tests
  • Loading branch information
sbaldu authored Aug 4, 2024
1 parent 9dac229 commit 92245d0
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 61 deletions.
56 changes: 13 additions & 43 deletions .github/workflows/installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,62 +33,38 @@ jobs:
docker build -t serial .
echo "Testing installation from PyPi"
docker run -t serial bash -c \
"pip install CLUEstering; python3 -c 'import CLUEstering' || exit 1"
echo "Testing installation from git repository"
docker run -t serial bash -c \
"git clone --recursive https://github.com/cms-patatrack/CLUEstering;
cd CLUEstering;
pip install . ;
python3 -c 'import CLUEstering' || exit 1"
docker run -t -v "$(pwd)"/../../:/app serial bash -c \
"cd /app && pip install .;
python3 -c 'import CLUEstering' || exit 0"
- name: Test installation inside docker containers (serial without boost)
working-directory: ${{github.workspace}}/docker/no_boost
run: |
docker build -t noboost .
echo "Testing installation from PyPi"
docker run -t noboost bash -c \
"pip install CLUEstering; python3 -c 'import CLUEstering' || exit 1"
echo "Testing installation from git repository"
docker run -t noboost bash -c \
"git clone --recursive https://github.com/cms-patatrack/CLUEstering;
cd CLUEstering;
pip install . ;
python3 -c 'import CLUEstering' || exit 1"
docker run -t -v "$(pwd)"/../../:/app noboost bash -c \
"cd /app && pip install .;
python3 -c 'import CLUEstering' || exit 0"
- name: Test installation inside docker containers (tbb)
working-directory: ${{github.workspace}}/docker/tbb
run: |
docker build -t tbb .
echo "Testing installation from PyPi"
docker run -t tbb bash -c \
"pip install CLUEstering; python3 -c 'import CLUEstering' || exit 1"
echo "Testing installation from git repository"
docker run -t tbb bash -c \
"git clone --recursive https://github.com/cms-patatrack/CLUEstering;
cd CLUEstering;
pip install . ;
python3 -c 'import CLUEstering' || exit 1"
docker run -t -v "$(pwd)"/../../:/app tbb bash -c \
"cd /app && pip install .;
python3 -c 'import CLUEstering' || exit 0"
- name: Test installation inside docker containers (without gcc)
working-directory: ${{github.workspace}}/docker/no_gcc
run: |
docker build -t nogcc .
echo "Testing installation from PyPi"
docker run -t nogcc bash -c \
"pip install CLUEstering; python3 -c 'import CLUEstering' || exit 0"
echo "Testing installation from git repository"
docker run -t nogcc bash -c \
"git clone --recursive https://github.com/cms-patatrack/CLUEstering;
cd CLUEstering;
pip install . ;
docker run -t -v "$(pwd)"/../../:/app nogcc bash -c \
"cd /app && pip install .;
python3 -c 'import CLUEstering' || exit 0"
- name: Test installation inside docker containers (without cmake)
Expand All @@ -97,12 +73,6 @@ jobs:
docker build -t nocmake .
echo "Testing installation from PyPi"
docker run -t nocmake bash -c \
"pip install CLUEstering; python3 -c 'import CLUEstering' || exit 0"
echo "Testing installation from git repository"
docker run -t nocmake bash -c \
"git clone --recursive https://github.com/cms-patatrack/CLUEstering;
cd CLUEstering;
pip install . ;
docker run -t -v "$(pwd)"/../../:/app nocmake bash -c \
"cd app && pip install .;
python3 -c 'import CLUEstering' || exit 0"
2 changes: 1 addition & 1 deletion CLUEstering/alpaka/AlpakaCore/CachedBufAlloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace cms::alpakatools {
template <typename TElem, typename TDim, typename TIdx, typename TQueue>
struct CachedBufAlloc<TElem, TDim, TIdx, alpaka::DevCpu, TQueue, void> {
template <typename TExtent>
ALPAKA_FN_HOST static auto allocCachedBuf(alpaka::DevCpu const& dev,
ALPAKA_FN_HOST static auto allocCachedBuf(alpaka::DevCpu const&,
TQueue queue,
TExtent const& extent)
-> alpaka::BufCpu<TElem, TDim, TIdx> {
Expand Down
4 changes: 2 additions & 2 deletions CLUEstering/alpaka/AlpakaCore/getDeviceIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ namespace cms::alpakatools {

// generic interface, for DevOacc and DevOmp5
template <typename Device>
inline int getDeviceIndex(Device const& device) {
inline int getDeviceIndex(const Device& device) {
return device.iDevice();
}

// overload for DevCpu
inline int getDeviceIndex(alpaka::DevCpu const& device) { return 0; }
inline int getDeviceIndex(const alpaka::DevCpu&) { return 0; }

#ifdef ALPAKA_ACC_GPU_CUDA_ENABLED
// overload for DevCudaRt
Expand Down
4 changes: 2 additions & 2 deletions CLUEstering/alpaka/CLUE/ConvolutionalKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class FlatKernel {

// Overload call operator
template <typename TAcc>
ALPAKA_FN_HOST_ACC float operator()(const TAcc& acc,
float dist_ij,
ALPAKA_FN_HOST_ACC float operator()(const TAcc&,
float /*dist_ij*/,
int point_id,
int j) const {
if (point_id == j) {
Expand Down
2 changes: 1 addition & 1 deletion CLUEstering/alpaka/DataFormats/alpaka/TilesAlpaka.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

template <typename TAcc>
ALPAKA_FN_HOST_ACC inline constexpr int getGlobalBinByBin(
const TAcc& acc, const VecArray<uint32_t, Ndim>& Bins) const {
const TAcc&, const VecArray<uint32_t, Ndim>& Bins) const {
uint32_t globalBin{Bins[0]};
for (int i{1}; i != Ndim; ++i) {
globalBin += n_tiles_per_dim * Bins[i];
Expand Down
34 changes: 22 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@

import os
import sys
from pathlib import Path
from setuptools import setup
import subprocess

__version__ = "2.2.5"
__version__ = "2.2.6"

this_directory = Path(__file__).parent
long_description = (this_directory/'README.md').read_text()

if sys.argv[1] != 'sdist':
os.system("cmake -B build && make -C build")
cmake_command = ['cmake', '-B', 'build']
make_command = ['make', '-C', 'build']

try:
# Execute the cmake command and print its output
subprocess.check_call(cmake_command, stderr=subprocess.STDOUT)
# Execute the make command and print its output
subprocess.check_call(make_command, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print(e.output)
sys.exit(e.returncode)


setup(
name="CLUEstering",
version=__version__,
author="Simone Balducci",
author_email="[email protected]",
description='''A library that generalizes the original 2-dimensional CLUE
algorithm made at CERN.''',
algorithm made at CERN.''',
long_description=long_description,
long_description_content_type='text/markdown',
packages=['CLUEstering'],
install_requires=['scikit-learn','numpy','matplotlib','pandas'],
install_requires=['scikit-learn', 'numpy', 'matplotlib', 'pandas'],
package_data={'': []},
keywords=['Python','Clustering','Binding'],
keywords=['Python', 'Clustering', 'Binding'],
python_requires='>=3.7',
classifiers=[
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
'Operating System :: Unix',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
'Operating System :: Unix',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
]
)

0 comments on commit 92245d0

Please sign in to comment.