Skip to content

Commit

Permalink
TryUseNativeMKL
Browse files Browse the repository at this point in the history
  • Loading branch information
DTTerastar committed Oct 7, 2024
1 parent 2057f55 commit a14ef2a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ RUN apt-get update \
WORKDIR /App

COPY . ./
RUN dotnet restore

RUN echo "I am running on ${BUILDPLATFORM}"
RUN echo "building for ${TARGETPLATFORM}"
RUN export TARGETPLATFORM="${TARGETPLATFORM}"

RUN dotnet add src/ESPresense.Companion.csproj package MathNet.Numerics.Providers.MKL
RUN dotnet restore
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:8.0
Expand All @@ -27,7 +28,18 @@ EXPOSE 8267 8268
ENV ASPNETCORE_URLS "http://+:8267"
ENV OTA_UPDATE_PORT 8268
ENV CONFIG_DIR "/config/espresense"

RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
apt-get update && apt-get install -y apt-transport-https gnupg software-properties-common wget && \
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \
echo "deb https://apt.repos.intel.com/mkl all main" > /etc/apt/sources.list.d/intel-mkl.list && \
apt-get update && apt-get install -y intel-mkl-64bit-2020.0-088; \
fi

COPY --from=build-env /App/out .

LABEL \
io.hass.version="VERSION" \
io.hass.type="addon" \
Expand Down
1 change: 1 addition & 0 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

builder.Host.UseSerilog((context, cfg) => cfg.ReadFrom.Configuration(context.Configuration));

MathNet.Numerics.Control.TryUseNativeMKL();
Log.Logger.Information(MathNet.Numerics.Control.Describe().Trim('\r','\n'));

var configDir = Environment.GetEnvironmentVariable("CONFIG_DIR") ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".espresense");
Expand Down

0 comments on commit a14ef2a

Please sign in to comment.