# Reducing app size

**URL:** <https://discourse.julialang.org/t/reducing-app-size/125957>\
**Category:** General Usage\
**Tags:** question, package, mkl\
**Created:** [February 16, 2025, 11:28am UTC](https://discourse.julialang.org/t/reducing-app-size/125957 "2025-02-16T11:28:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 16, 2025, 11:28am UTC](https://discourse.julialang.org/t/reducing-app-size/125957/1 "2025-02-16T11:28:03Z")

</div>

I have a package that I want deploy as application in a docker container. I am trying to reduce the size. Current sizes:

- 1,7G /tmp/testdepot/
- 514M /tmp/test  
The second item is mainly the compiled system image.

If I have a system image, can I delete subfolders of the “depot”?

For example, can I delete:

- 750M /tmp/testdepot/compiled
- 770M /tmp/testdepot/artifacts
- 119M /tmp/testdepot/packages

Or anything else?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 16, 2025, 1:23pm UTC](https://discourse.julialang.org/t/reducing-app-size/125957/2 "2025-02-16T13:23:34Z")

</div>

Deleting the folder “testdepot/compiled” seams to work and should also be safe in the sense that if I forgot a package in the system image it will just re-appear here.

If I look into the “artifacts” folder, MKL is the largest artifact:

```julia
ufechner@ufryzen:/tmp/testdepot/artifacts$ du -h 03b04466a9b7dc64deb348ce55333edc5dd6b0ce/
12K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share/licenses/MKL
16K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share/licenses
20K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share
525M	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/lib
525M	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/

```

```julia
ufechner@ufryzen:/tmp/testdepot/artifacts/03b04466a9b7dc64deb348ce55333edc5dd6b0ce/lib$ ls
libmkl_avx2.so libmkl_cdft_core.so.2 libmkl_intel_lp64.so libmkl_sequential.so.2
libmkl_avx2.so.2 libmkl_core.so libmkl_intel_lp64.so.2 libmkl_tbb_thread.so
libmkl_avx512.so libmkl_core.so.2 libmkl_intel_thread.so libmkl_tbb_thread.so.2
libmkl_avx512.so.2 libmkl_def.so libmkl_intel_thread.so.2 libmkl_vml_avx2.so
libmkl_blacs_intelmpi_ilp64.so libmkl_def.so.2 libmkl_mc3.so libmkl_vml_avx2.so.2
libmkl_blacs_intelmpi_ilp64.so.2 libmkl_gf_ilp64.so libmkl_mc3.so.2 libmkl_vml_avx512.so
libmkl_blacs_intelmpi_lp64.so libmkl_gf_ilp64.so.2 libmkl_rt.so libmkl_vml_avx512.so.2
libmkl_blacs_intelmpi_lp64.so.2 libmkl_gf_lp64.so libmkl_rt.so.2 libmkl_vml_cmpt.so
libmkl_blacs_openmpi_ilp64.so libmkl_gf_lp64.so.2 libmkl_scalapack_ilp64.so libmkl_vml_cmpt.so.2
libmkl_blacs_openmpi_ilp64.so.2 libmkl_gnu_thread.so libmkl_scalapack_ilp64.so.2 libmkl_vml_def.so
libmkl_blacs_openmpi_lp64.so libmkl_gnu_thread.so.2 libmkl_scalapack_lp64.so libmkl_vml_def.so.2
libmkl_blacs_openmpi_lp64.so.2 libmkl_intel_ilp64.so libmkl_scalapack_lp64.so.2 libmkl_vml_mc3.so
libmkl_cdft_core.so libmkl_intel_ilp64.so.2 libmkl_sequential.so libmkl_vml_mc3.so.2

```

Can I delete those that I do not need? How can I find out which is actually used?

Created an issue: [Reduce size of artifacts · Issue #179 · JuliaLinearAlgebra/MKL.jl · GitHub](https://github.com/JuliaLinearAlgebra/MKL.jl/issues/179)

To answer my second question:

```julia
sudo grep /tmp/testdepot/* /proc/*/maps | grep mkl

```

shows me which .so files of mkl are in use.

To answer my first question:  
The following script deletes all but the two .so files that I need:

```julia
cd /tmp/testdepot/artifacts/03b04466a9b7dc64deb348ce55333edc5dd6b0ce/lib/
mkdir bak
mv libmkl_rt.so.2 bak
mv libmkl_rt.so bak
mv libmkl_core.so.2 bak
mv libmkl_core.so bak
find . -maxdepth 1 -type f,l -exec rm -f {} \;
mv bak/* .
rmdir bak
cd /tmp/testdepot

```

The size of the MKL artifacts is reduced from 525M to 83M.

```julia
c5dd6b0ce/
12K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share/licenses/MKL
16K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share/licenses
20K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share
83M	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/lib
83M	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/

```
