Skip to content

Commit e3a9571

Browse files
ngxsonXuan Son Nguyen
authored andcommitted
devops : add intel oneapi dockerfile (ggml-org#5068)
Co-authored-by: Xuan Son Nguyen <[email protected]>
1 parent f8c0af9 commit e3a9571

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

.devops/main-intel.Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ARG ONEAPI_VERSION=2024.0.1-devel-ubuntu22.04
2+
ARG UBUNTU_VERSION=22.04
3+
4+
FROM intel/hpckit:$ONEAPI_VERSION as build
5+
6+
RUN apt-get update && \
7+
apt-get install -y git
8+
9+
WORKDIR /app
10+
11+
COPY . .
12+
13+
# for some reasons, "-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=Intel10_64lp -DLLAMA_NATIVE=ON" give worse performance
14+
RUN mkdir build && \
15+
cd build && \
16+
cmake .. -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx && \
17+
cmake --build . --config Release --target main server
18+
19+
FROM ubuntu:$UBUNTU_VERSION as runtime
20+
21+
COPY --from=build /app/build/bin/main /main
22+
COPY --from=build /app/build/bin/server /server
23+
24+
ENV LC_ALL=C.utf8
25+
26+
ENTRYPOINT [ "/main" ]

.github/workflows/docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- { tag: "full-cuda", dockerfile: ".devops/full-cuda.Dockerfile", platforms: "linux/amd64" }
3636
- { tag: "light-rocm", dockerfile: ".devops/main-rocm.Dockerfile", platforms: "linux/amd64,linux/arm64" }
3737
- { tag: "full-rocm", dockerfile: ".devops/full-rocm.Dockerfile", platforms: "linux/amd64,linux/arm64" }
38+
- { tag: "light-intel", dockerfile: ".devops/main-intel.Dockerfile", platforms: "linux/amd64" }
3839
steps:
3940
- name: Check out the repo
4041
uses: actions/checkout@v3

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,11 @@ function(get_flags CCID CCVER)
478478
if (CCVER VERSION_GREATER_EQUAL 8.1.0)
479479
set(CXX_FLAGS ${CXX_FLAGS} -Wextra-semi)
480480
endif()
481+
elseif (CCID MATCHES "Intel")
482+
# enable max optimization level when using Intel compiler
483+
set(C_FLAGS -ipo -O3 -static -fp-model=fast -flto -fno-stack-protector)
484+
set(CXX_FLAGS -ipo -O3 -static -fp-model=fast -flto -fno-stack-protector)
485+
add_link_options(-fuse-ld=lld -static-intel)
481486
endif()
482487

483488
set(GF_C_FLAGS ${C_FLAGS} PARENT_SCOPE)

0 commit comments

Comments
 (0)