MATLAB Answers

1

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

Asked by Igor Varfolomeev on 2 Nov 2018
Latest activity Commented on by Igor Varfolomeev on 23 May 2019
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?

  0 Comments

Sign in to comment.

2 Answers

Answer by Lipi Vora on 20 May 2019
 Accepted Answer

Starting R2019a, the cudnn64_*.dll is not packaged in the CTF by default.
For previous releases, please see bug report:

  1 Comment

Igor Varfolomeev 2019 年 5 月 23 日
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...

Sign in to comment.


Answer by Sitra
on 23 Nov 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 Comments

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 2018 年 11 月 26 日
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.

Sign in to comment.