Reducing app size

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?

1 Like

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:

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/
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

To answer my second question:

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:

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.

c5dd6b0ce/
12K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share/licenses/MKL
16K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share/licenses
20K	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/share
83M	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/lib
83M	03b04466a9b7dc64deb348ce55333edc5dd6b0ce/
4 Likes