Skip to content
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

Remove runtime unit test dependency on aoc #368

Merged
merged 5 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
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
17 changes: 0 additions & 17 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,6 @@ jobs:
cd build
ninja -v -k0

- name: cache aocl
id: cache-aocl
uses: actions/cache@v4
with:
path: c:\aocl
key: aocl-${{ hashFiles('.github/workflows/build-windows.yml', 'scripts/install_aocl.ps1') }}

- name: install aocl
if: ${{ !steps.cache-aocl.outputs.cache-hit }}
run: pwsh .\scripts\install_aocl.ps1 -installdir C:\aocl

- name: add aocl to path
run: echo c:\aocl\hld\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: query aocl version
run: aoc -version

- name: test runtime
run: |
cd build
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ on:
- 'container/opensuse-leap-15-dev/**'
- 'container/ubuntu-20.04-dev/**'
- 'container/ubuntu-22.04-dev/**'
- 'scripts/install_aocl.sh'

pull_request:
paths:
Expand All @@ -47,7 +46,6 @@ on:
- 'container/opensuse-leap-15-dev/**'
- 'container/ubuntu-20.04-dev/**'
- 'container/ubuntu-22.04-dev/**'
- 'scripts/install_aocl.sh'

workflow_dispatch:

Expand Down
61 changes: 17 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

### Linux

- Red Hat Enterprise Linux (RHEL)\* or Rocky Linux\* 8
- Red Hat Enterprise Linux (RHEL)\* or Rocky Linux\* 8 or 9
- SUSE Linux Enterprise Server (SLES)\* or openSUSE Leap\* 15
- Ubuntu\* 18.04, 20.04, or 22.04 LTS
- GCC 7.4.0 and higher
- Ubuntu\* 20.04, or 22.04 LTS
- GCC 7.5.0 and higher
- [CMake](https://cmake.org/) 3.10 and higher
- [Ninja](https://ninja-build.org/) 1.8.2 and higher
- [Git](https://git-scm.com/)
Expand All @@ -17,7 +17,7 @@
### Windows

- Windows\* 10 (64 bit)
- Windows Server\* 2012, 2016, or 2019
- Windows Server\* 2019 or 2022
- Microsoft Visual C++ (MSVC)\* 2017 and higher
- [CMake](https://cmake.org/) 3.10 and higher
- [Ninja](https://ninja-build.org/) 1.8.2 and higher
Expand Down Expand Up @@ -113,45 +113,6 @@ ctest -V

### Notes

- To run unit tests, you need the `aoc` executable from the IntelⓇ FPGA SDK
for OpenCL™.

To set the path to `aoc`, change to the IntelⓇ FPGA SDK for OpenCL™
installation directory and source the initialization script.

- On Linux:

```
source init_opencl.sh
```

- On Windows:

```
call init_opencl.bat
```

- On Linux, `aoc` requires the `libtinfo.so.5` library, which you can install
using one of the following OS-specific commands:

- Red Hat Enterprise Linux (RHEL)\* or Rocky Linux\* 8:

```
sudo yum install ncurses-compat-libs-6.1
```

- SUSE Linux Enterprise Server (SLES)\* or openSUSE Leap\* 15:

```
sudo zypper install libncurses5
```

- Ubuntu\* 18.04 or 20.04 LTS:

```
sudo apt install libtinfo5
```

- On Windows, you need to set the paths to the libelf and (optionally) zlib libraries.

```
Expand Down Expand Up @@ -186,7 +147,19 @@ Perform these steps if you have the IntelⓇ FPGA SDK for OpenCL™ or
IntelⓇ FPGA RTE for OpenCL™ installed on your system:

1. In the IntelⓇ FPGA SDK for OpenCL™ installation directory, source
the initialization script (see [Running Unit Tests](#running-unit-tests)).
the initialization script.

- On Linux:

```
source init_opencl.sh
```

- On Windows:

```
call init_opencl.bat
```

2. Update the `/etc/OpenCL/vendors/Altera.icd` file with either the filename
`libalteracl.so` if `LD_LIBRARY_PATH` contains the full path of the runtime
Expand Down
7 changes: 0 additions & 7 deletions container/opensuse-leap-15-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,9 @@ RUN zypper -n update \
which \
zlib-devel \
&& zypper -n clean \
&& ./install_aocl.sh /opt/aocl \
&& useradd --system ${uid:+--uid "$uid"} --user-group --shell /sbin/nologin --create-home --home-dir /home/build build \
&& echo 'build ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/build \
&& rm -rf "$PWD"

USER build
WORKDIR /home/build

ENV PATH="/opt/aocl/hld/bin:$PATH"
# Workaround for libnsl.so.1 not installed by default on the latest OpenSUSE image
RUN mkdir -p /tmp/aoc && ln -snf /usr/lib64/libnsl.so.2.0.0 /tmp/aoc/libnsl.so.1
ENV LD_LIBRARY_PATH="/tmp/aoc:$LD_LIBRARY_PATH"
RUN aoc -version
4 changes: 0 additions & 4 deletions container/rockylinux-8-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ RUN \
which \
zlib-devel \
&& yum -y clean all \
&& ./install_aocl.sh /opt/aocl \
&& useradd --system ${uid:+--uid "$uid"} --user-group --shell /sbin/nologin --create-home --home-dir /home/build build \
&& echo 'build ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/build \
&& rm -rf "$PWD"

USER build
WORKDIR /home/build

ENV PATH="/opt/aocl/hld/bin:$PATH"
RUN aoc -version
4 changes: 0 additions & 4 deletions container/rockylinux-9-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ RUN \
which \
zlib-devel \
&& yum -y clean all \
&& ./install_aocl.sh /opt/aocl \
&& useradd --system ${uid:+--uid "$uid"} --user-group --shell /sbin/nologin --create-home --home-dir /home/build build \
&& echo 'build ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/build \
&& rm -rf "$PWD"

USER build
WORKDIR /home/build

ENV PATH="/opt/aocl/hld/bin:$PATH"
RUN aoc -version
4 changes: 0 additions & 4 deletions container/ubuntu-20.04-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ RUN apt-get -y update \
sudo \
zlib1g-dev \
&& apt-get -y clean \
&& ./install_aocl.sh /opt/aocl \
&& useradd --system ${uid:+--uid "$uid"} --user-group --shell /sbin/nologin --create-home --home-dir /home/build build \
&& echo 'build ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/build \
&& rm -rf "$PWD"

USER build
WORKDIR /home/build

ENV PATH="/opt/aocl/hld/bin:$PATH"
RUN aoc -version
4 changes: 1 addition & 3 deletions container/ubuntu-22.04-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ RUN apt-get -y update \
sudo \
zlib1g-dev \
&& apt-get -y clean \
&& ./install_aocl.sh /opt/aocl \
&& useradd --system ${uid:+--uid "$uid"} --user-group --shell /sbin/nologin --create-home --home-dir /home/build build \
&& echo 'build ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/build \
&& rm -rf "$PWD"

USER build
WORKDIR /home/build

ENV PATH="/opt/aocl/hld/bin:/usr/lib/llvm-13/bin:$PATH"
RUN aoc -version
ENV PATH="/usr/lib/llvm-13/bin:$PATH"
RUN clang-format --version
28 changes: 0 additions & 28 deletions scripts/install_aocl.ps1

This file was deleted.

21 changes: 0 additions & 21 deletions scripts/install_aocl.sh

This file was deleted.

5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ target_link_libraries(acl_test PRIVATE
)
add_test(NAME acl_test COMMAND acl_test -v)
set_property(TEST acl_test PROPERTY ENVIRONMENT
"AOCL_BOARD_PACKAGE_ROOT=${CMAKE_CURRENT_SOURCE_DIR}/board/a10_ref"
"\
AOCL_BOARD_PACKAGE_ROOT=${CMAKE_CURRENT_SOURCE_DIR}/board/a10_ref;\
ACL_TEST_EXAMPLE_BINARY=${CMAKE_CURRENT_SOURCE_DIR}/example_binary\
"
)

add_subdirectory(fake_bsp)
6 changes: 6 additions & 0 deletions test/acl_kernel_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,12 @@ TEST(acl_kernel, enqueue_ndrange) {
MT_TEST(acl_kernel, test_local_work_group_size_debug_msg) {
ACL_LOCKED(acl_print_debug_msg("test local wg size debug msg\n"));

if (acl_getenv(ENV_ACL_CONTEXT_CALLBACK_DEBUG)) {
// Skip this test if ACL_CONTEXT_CALLBACK_DEBUG is set as it will
// disrupt printed messages.
return;
}

// Create buffer for debug msg
std::stringstream msg_buf;
std::streambuf *cout_ptr = std::cout.rdbuf(msg_buf.rdbuf());
Expand Down
30 changes: 23 additions & 7 deletions test/acl_program_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ MT_TEST_GROUP(from_source) {

void load(int compiler_mode =
CL_CONTEXT_COMPILER_MODE_OFFLINE_CREATE_EXE_LIBRARY_INTELFPGA,
const char *compile_command = 0, bool print_notify = true) {
std::string compile_command = "", bool print_notify = true) {
unload();
CHECK_EQUAL(CL_SUCCESS, clGetPlatformIDs(1, &m_platform, 0));
CHECK(acl_platform_is_valid(m_platform));
Expand All @@ -853,14 +853,31 @@ MT_TEST_GROUP(from_source) {
&m_device[0], &m_num_devices));
CHECK(m_num_devices > 0);

// Check if there is precompiled binaries, if envvar set, use that instead
const char *envvar_example_binary = "ACL_TEST_EXAMPLE_BINARY";
const char *example_binary_root = acl_getenv(envvar_example_binary);
if (example_binary_root) {
// Precompiled binaries exist, emulate the compile by copying the
// precompiled binaries to the current directory.
#ifdef _WIN32
std::string bin_file =
std::string(example_binary_root) + "/windows/foo.aocr";
#else
std::string bin_file =
std::string(example_binary_root) + "/linux/foo.aocr";
#endif
compile_command = "cp " + bin_file + " ./kernels.aocr && echo ";
}

cl_int status = CL_INVALID_DEVICE;
cl_context_properties props[] = {
CL_CONTEXT_PROGRAM_EXE_LIBRARY_ROOT_INTELFPGA,
(cl_context_properties)m_basedir.c_str(),
CL_CONTEXT_COMPILER_MODE_INTELFPGA,
compiler_mode,
(compile_command ? CL_CONTEXT_COMPILE_COMMAND_INTELFPGA : 0),
(cl_context_properties)compile_command,
(compile_command != "" ? CL_CONTEXT_COMPILE_COMMAND_INTELFPGA : 0),
(cl_context_properties)(compile_command != "" ? compile_command.c_str()
: 0),
0,
0};
m_context =
Expand Down Expand Up @@ -949,7 +966,8 @@ MT_TEST(from_source, make_prog_dir_and_build_command) {

// Default arguments, just turning off printing of errors for invalid calls to
// be tested below
load(CL_CONTEXT_COMPILER_MODE_OFFLINE_CREATE_EXE_LIBRARY_INTELFPGA, 0, false);
load(CL_CONTEXT_COMPILER_MODE_OFFLINE_CREATE_EXE_LIBRARY_INTELFPGA, "",
false);
load_program();

// Before build. No executable.
Expand Down Expand Up @@ -1082,11 +1100,9 @@ MT_TEST(from_source, online_mode) {
ACL_LOCKED(CHECK(acl_realpath_existing(check_str) != ""));
check_str = m_hashdir + std::string("/build.cmd");
ACL_LOCKED(CHECK(acl_realpath_existing(check_str) != ""));
// Since we invoked compiler with -rtl, we only get an .aoco and .aocr
// If we have invoked compiler with -rtl, we should get an .aocr
check_str = m_hashdir + std::string("/kernels.aocr");
ACL_LOCKED(CHECK(acl_realpath_existing(check_str) != ""));
check_str = m_hashdir + std::string("/kernels/kernels.v");
ACL_LOCKED(CHECK(acl_realpath_existing(check_str) != ""));

// Check the build log.
size_t size_ret;
Expand Down
Loading