Matlab compiler resulting ".exe" file size and "cudnn64_*.dll"

5 visualizaciones (últimos 30 días)
Igor Varfolomeev
Igor Varfolomeev el 2 de Nov. de 2018
Comentada: Daniel el 23 de En. de 2020
I'm recently used Matlab Compiler mcc command to create a standalone executable (there's no MCR installed included). And found that the resulting " .exe" size is somewhat too large --- 289 MB. I do not feel myself comfortable, when I need to pass an exe like this to my colleague - he might say something bad about Matlab :) .
I known the ` -N` switch, that allows to prevent including not-actually-needed toolboxes. It doesn't help. The toolboxes I do need here are: Parallel Processing and Image Processing.
The ".exe" files were not that big before, so I've decided to try several Matlab versions, and unpack each " .exe" generated. I've immediately noticed that the largest file inside is " cudnn64_*.dll".
Results:
release exe size cudnn size cudnn_name
------- -------- ---------- ---------------
R2018b 289 MB 324 MB "cudnn64_7.dll"
R2017b_Update9 230 MB 284 MB "cudnn64_7.dll"
R2017b_noUpdates 81 MB 75 MB "cudnn64_5.dll"
R2016b 32.2MB 0 MB *no such file*
So, " cudnn*.dll" plays a major role in wasting space here.
I do not use this ".dll" in this project, actually. I wonder why Matlab thinks I do. So, I've temporarily renamed it to ".dll__", and re-compiled my ".exe". And now the resulting ".exe" got significantly smaller (29MB in R2017b_noUpdates, which looks more-or-less OK). And it still works. Maybe this approach would help someone else.
My questions are:
  • So.. Any idea how to improve this even further, without too much effort?
  • There is a copy of this dll in the MCR installation itself (the same, byte-to-byte, except for "R2017b_Update9" --- there's just no MCR updates available currently) . Why include it both here and there? Why R2016b is "smarter", and does not not include this unnecessary dll? Is this regression a bug?

Respuesta aceptada

Lipi Vora
Lipi Vora el 20 de Mayo de 2019
Starting R2019a, the cudnn64_*.dll is not packaged in the CTF by default.
For previous releases, please see bug report:
  1 comentario
Igor Varfolomeev
Igor Varfolomeev el 23 de Mayo de 2019
Thanks!
I've just tried to build the same code with R2019a update 2 - I can confirm that there's no " cudnn*" inside. The size of the "exe" is 73MB - larger than R2017b_update9 with cudnn renamed (47.9MB).
Now the largest dll inside is "Halide.dll" (55.4MB) (~18MB if packed to zip). Not sure if it's actually used...

Iniciar sesión para comentar.

Más respuestas (2)

Daniel
Daniel el 23 de En. de 2020
Hi,
I noticed that using R2019a, I can replace Halide.dll with a 0-byte dummy file in the executable, to reduce file size. I cannot remove it from the archive since MATLAB checks for the presence of the file, but I can replace it with a dummy file of size zero, and the executable still runs.
I used 7-zip to manipulate the archive/executable.
If compilation isn't done too often, this might be an acceptable solution.
Best,
Daniel
  1 comentario
Daniel
Daniel el 23 de En. de 2020
Forgot to mention: the executable was built with !mcc from the MATLAB command line, using Microsoft Visual C++ 2017, in case the specifics matter.

Iniciar sesión para comentar.


Sitra
Sitra el 23 de Nov. de 2018
I'm facing the same thing
I think Mathworks should seriously focus on this BIG TECHNICAL ISSUE. Many programmers when they reach to this point, they will force to re-program their code from scratch using other programming languages (such as Python with pyqt) to avoid large .exe applications as we face with MATLAB
I have designed many great GUIs using MATLAB, but still I cannot compile them to my friends and community because they will start questioning me regarding this unncessary file size! Is it logical to design a simple GUI (like displaying a "Hello World" message only) to end up with a very large file!! If I program the same code using qt with C++ or pyqt with Python, it will be just fee kilobytes files size, automatically without diving into a mysterious codes with mcc -xx; Am I correct?
This is a big boundary and obstacle that should be addressed as one of the highest priority problems that need to be solved immediately
I hope my concern reaches Mathworks to let us benefiting from a great and smart language like MATLAB
Thank you so much
  2 comentarios
Igor Varfolomeev
Igor Varfolomeev el 23 de Nov. de 2018
Editada: Igor Varfolomeev el 23 de Nov. de 2018
Yep, I think the "exe size is unexpectedly large" problem is relevant for all Matlab Compiler / Matlab Compiler SDK users. And there seem to be no progress with fixing this. I'd even say the same code produces even larger exe with each new Matlab release.
Probably, Mathworks just got no idea how to solve this, due to the code structure and lack of packages/namespaces, especially in the old parts of code.
But my initial idea here was to highlight a single file which wastes way too much space. That's one of the largest files in the whole Matlab distribution. I doubt it's used by more than 1% of all deployed apps. And they include it... twice. I doubt they would be able to "properly fix the issue" (resolve all dependencies, and only include what's actually needed), but I hope they would at least manually fix few largest space-wasters.
I've sent effectively the same message to Mathworks support (initially I hoped someone from Mathworks would respond here). I'll report back when they'll provide some reply.
Igor Varfolomeev
Igor Varfolomeev el 26 de Nov. de 2018
I've received the reply from the support. They said they know about the issue (both "CTF size is too large" and about "cudnn64_* is both in CTF and MCR") and that they are working on it.
Well, I hope they would eventually fix this.

Iniciar sesión para comentar.

Categorías

Más información sobre Manage Products en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by