Skip to content
Closed
Changes from all commits
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
18 changes: 18 additions & 0 deletions hls4ml/backends/oneapi/oneapi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ def compile(self, model):
try:
subprocess.run('which icpx', shell=True, cwd=builddir, check=True)
except subprocess.CalledProcessError:
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this try - except block if the pytest import only happens when it's available?

import os

if "PYTEST_CURRENT_TEST" in os.environ:
import pytest

pytest.skip('icpx not present')
except ImportError:
pass
raise RuntimeError('Could not find icpx. Please configure oneAPI appropriately')
subprocess.run('cmake ..', shell=True, cwd=builddir, check=True)
subprocess.run('make lib', shell=True, cwd=builddir, check=True)
Expand All @@ -200,6 +209,15 @@ def build(self, model, build_type='fpga_emu', run=False):
try:
subprocess.run('which icpx', shell=True, cwd=builddir, check=True)
except subprocess.CalledProcessError:
try:
import os

if "PYTEST_CURRENT_TEST" in os.environ:
import pytest

pytest.skip('icpx not present')
except ImportError:
pass
raise RuntimeError('Could not find icpx. Please configure oneAPI appropriately')
subprocess.run('cmake ..', shell=True, cwd=builddir, check=True)
subprocess.run(f'make {build_type}', shell=True, cwd=builddir, check=True)
Expand Down
Loading