How to fast compile GPU coder application after making a minor change in main.cu?

I use GPU coder to compile Deep Learning based application. But, I made a slight change in main.cu (mainly in the file management and reading part). I then want to recompile the GPU coder application. but it takes so long to repeat converting deep learning models to cuda codes. Is there an easy way to recompile the GPU coder application faster?

Réponses (1)

Hi @Liwei,
If you generated an EXE by specifying main.cu as CustomSource similar to the example here, then you can can rebuild the executable by running make on the generated <entrypoint_function>_rtw.mk.
For example, if your entry point function is foo.m, you should see a file named foo_rtw.mk in the codegen folder on Linux devices.
You can then execute
make -f foo_rtw.mk
from the linux terminal by 'cd'ing to the codegen folder or from within MATLAB as follows:
!make -f foo_rtw.mk
On Windows, there is an equivalent "batch" file with the '.bat' extension that you can run to rebuild the files.
If you generated a DLL or LIB using the coder.gpuConfig, then you likely have a custom makefile to link to the library generated by coder. In that case you will need to remake your custom makefile.
Hari

6 commentaires

Liwei
Liwei le 21 Déc 2022
Modifié(e) : Liwei le 21 Déc 2022
Thank you! what is the command for windows 10? My matlab is installed on windows. I am compiling the Deep learning using GPU coder to nvidia JETSON device.
I tried the command in matlab in windows operating system. it shows
Did you mean:
>> make -f foo_rtw.mk
Unrecognized function or variable 'make'.
Did you mean:
>> mae -f foot_rtw.mk
Hi @Liwei,
Do you wish to edit the main.cu file on your Windows PC and then transfer it to the NVIDIA Jetson device and recompile? Or are you editing the main.cu file directly in the codegen folder on the NVIDIA Jetson hardware?
edit the main.cu on windows PC in Matlab, then compile in matlab using GPU coder? No changes on Deep learning part, just main.cu (with some data file management). Nny function script to make it faster compile?
It seemed to have be recompiled in Matlab through GPU coder. Is there any fast way to recompile?
On Windows, you can execute the batch file from within the codegen folder as follows:
>> system('<entryPointFcn>_rtw.bat');
For example, if the function you generated code for was named 'foo', then the batch file would be named 'foo_rtw.bat'.
happy new year! I came back with this question again after the winter break. I use main.cu and gpu coder to create exe file to be exexuted on nevidia device. Now, I changed a little in my main.cu file and wanted to compile fast. My matlab and gpu coder are on windows 10. Under codgen\exe\foo folder, I could not find batch file, i found out foo_rtw.mk file. Then I run the following command after setting MATLAB TO codgen\exe\foo\ folder. None of the commands works. any idea on it?
!make -f foo_rtw.mk
'make' is not recognized as an internal or external command,
operable program or batch file.
system('foo_rtw.bat');
is not recognized as an internal or external command,
operable program or batch file.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Get Started with GPU Coder dans Centre d'aide et File Exchange

Produits

Version

R2022b

Question posée :

le 21 Déc 2022

Commenté :

le 17 Jan 2023

Community Treasure Hunt

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

Start Hunting!

Translated by