Skip to content

Commit 8c5a216

Browse files
committed
Merge remote-tracking branch 'upstream/main' into uwe/native_cpu
2 parents 3cf6351 + 5b4c3d2 commit 8c5a216

File tree

5 files changed

+166
-0
lines changed

5 files changed

+166
-0
lines changed

.github/docker/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Content
2+
3+
Dockerfiles and scripts placed in this directory are intended to be used as
4+
development process vehicles and part of continuous integration process.
5+
6+
Images built out of those recipes may be used with Docker or podman as
7+
development environment.
8+
9+
# How to build docker image
10+
11+
To build docker image on local machine execute:
12+
13+
```sh
14+
docker build -t ur:ubuntu-22.04 -f ./ubuntu-22.04.Dockerfile .
15+
```
16+
17+
To set any build time variable (e.g., an optional ARG from docker recipe), add to the command (after `build`), e.g.:
18+
19+
```sh
20+
--build-arg SKIP_DPCPP_BUILD=1
21+
```
22+
23+
One other example of using these extra build arguments are proxy settings. They are required for accessing network
24+
(e.g., to download dependencies within docker), if a host is using a proxy server. Example usage:
25+
26+
```sh
27+
--build-arg https_proxy=http://proxy.com:port --build-arg http_proxy=http://proxy.com:port
28+
```
29+
30+
# How to use docker image
31+
32+
To run docker container (using the previously built image) execute:
33+
34+
```sh
35+
docker run --shm-size=4G -v /your/workspace/path/:/opt/workspace:z -w /opt/workspace/ -it ur:ubuntu-22.04 /bin/bash
36+
```
37+
38+
To set (or override) any docker environment variable, add to the command (after `run`):
39+
40+
```sh
41+
-e ENV_VARIABLE=VALUE
42+
```

.github/docker/install_dpcpp.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
# Copyright (C) 2023 Intel Corporation
3+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See LICENSE.TXT
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
7+
#
8+
# install_dpcpp.sh - unpacks DPC++ in ${DPCPP_PATH}, to be used while building UR
9+
#
10+
11+
set -e
12+
13+
if [ "${SKIP_DPCPP_BUILD}" ]; then
14+
echo "Variable 'SKIP_DPCPP_BUILD' is set; skipping building DPC++"
15+
exit
16+
fi
17+
18+
apt-get install -y --no-install-recommends \
19+
libncurses5
20+
21+
mkdir -p ${DPCPP_PATH}
22+
wget -O ${DPCPP_PATH}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz
23+
tar -xvf ${DPCPP_PATH}/dpcpp_compiler.tar.gz -C ${DPCPP_PATH}/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
# Copyright (C) 2023 Intel Corporation
3+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See LICENSE.TXT
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
7+
#
8+
# install_libbacktrace.sh - builds and installs tracing library
9+
#
10+
11+
set -e
12+
13+
if [ "${SKIP_LIBBACKTRACE_BUILD}" ]; then
14+
echo "Variable 'SKIP_LIBBACKTRACE_BUILD' is set; skipping building libbacktrace"
15+
exit
16+
fi
17+
18+
git clone https://github.com/ianlancetaylor/libbacktrace.git
19+
pushd libbacktrace
20+
./configure
21+
make -j$(nproc)
22+
make install -j$(nproc)
23+
popd
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright (C) 2023 Intel Corporation
2+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See LICENSE.TXT
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
#
7+
# Dockerfile - image with all Unified Runtime dependencies.
8+
#
9+
10+
# Pull base image
11+
FROM registry.hub.docker.com/library/ubuntu:22.04
12+
13+
# Set environment variables
14+
ENV OS ubuntu
15+
ENV OS_VER 22.04
16+
ENV NOTTY 1
17+
ENV DEBIAN_FRONTEND noninteractive
18+
19+
# Additional parameters to build docker without building components.
20+
# These ARGs can be set in docker building phase and are used
21+
# within bash scripts (executed within docker).
22+
ARG SKIP_DPCPP_BUILD
23+
ARG SKIP_LIBBACKTRACE_BUILD
24+
25+
# Base development packages
26+
ARG BASE_DEPS="\
27+
build-essential \
28+
cmake \
29+
git"
30+
31+
# Unified Runtime's dependencies
32+
ARG UR_DEPS="\
33+
doxygen \
34+
python3 \
35+
python3-pip"
36+
37+
# Unified Runtime's dependencies (installed via pip)
38+
ARG UR_PYTHON_DEPS="\
39+
clang-format==15.0.7"
40+
41+
# Miscellaneous for our builds/CI (optional)
42+
ARG MISC_DEPS="\
43+
clang \
44+
sudo \
45+
wget \
46+
whois"
47+
48+
# Update and install required packages
49+
RUN apt-get update \
50+
&& apt-get install -y --no-install-recommends \
51+
${BASE_DEPS} \
52+
${UR_DEPS} \
53+
${MISC_DEPS} \
54+
&& apt-get clean all
55+
56+
RUN pip3 install ${UR_PYTHON_DEPS}
57+
58+
# Install DPC++
59+
COPY install_dpcpp.sh install_dpcpp.sh
60+
ENV DPCPP_PATH=/opt/dpcpp
61+
RUN ./install_dpcpp.sh
62+
63+
# Install libbacktrace
64+
COPY install_libbacktrace.sh install_libbacktrace.sh
65+
RUN ./install_libbacktrace.sh
66+
67+
# Add a new (non-root) 'user'
68+
ENV USER user
69+
ENV USERPASS pass
70+
RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS`

cmake/helpers.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function(add_ur_target_compile_options name)
6666
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
6767
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics>
6868
)
69+
6970
if (CMAKE_BUILD_TYPE STREQUAL "Release")
7071
target_compile_definitions(${name} PRIVATE -D_FORTIFY_SOURCE=2)
7172
endif()
@@ -81,6 +82,13 @@ function(add_ur_target_compile_options name)
8182
/MP
8283
/W3
8384
/MD$<$<CONFIG:Debug>:d>
85+
/GS
86+
)
87+
add_link_options(
88+
/DYNAMICBASE
89+
/HIGHENTROPYVA
90+
/ALLOWISOLATION
91+
/NXCOMPAT
8492
)
8593

8694
if(UR_DEVELOPER_MODE)

0 commit comments

Comments
 (0)