Matlab Compiler Standalone Application and startup.m

3 visualizzazioni (ultimi 30 giorni)
So I'm trying to use the Matlab Compiler in order to build a standalone application which to run on a separate machine using MCR. The actual application follows this guide to benchmark GPU. When I open matlab following this I make the following command to compile the standalone application:
mcc -mv -o gpuTest mainBench.m benchFcn.m executeBenchmarks.m getData.m paralleldemo_gpu_backslash.m timeSolve.m waitForCpu.m waitForGpu.m
The output is:
Compiler version: 5.1 (R2014a)
Dependency analysis by REQUIREMENTS.
Parsing file "/media/hdd/work/matlab/gpuBench/mainBench.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/benchFcn.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/executeBenchmarks.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/getData.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/paralleldemo_gpu_backslash.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/timeSolve.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/waitForCpu.m"
(Referenced from: "Compiler Command Line").
Parsing file "/media/hdd/work/matlab/gpuBench/waitForGpu.m"
(Referenced from: "Compiler Command Line").
Parsing file "/opt/MATLAB/R2014a/toolbox/compiler/deploy/deployprint.m"
(Referenced from: "Compiler Command Line").
Parsing file "/opt/MATLAB/R2014a/toolbox/compiler/deploy/printdlg.m"
(Referenced from: "Compiler Command Line").
Than on the other machine, given that the environmental variables are set I just execute the command
./gpuTest
The resulting error is:
Cannot CD to /media/hdd/work/matlab (Name is nonexistent or not a directory).
Error in startup (line 1)
Problem is there is no "startup" script from in the folder of the scripts that should have been compiled. However I do have a "startup.m" script which is in my startup folder which in fact exactly executes "cd /media/hdd/work/matlab" and some other stuff.
I have 2 questions:
  1. Why the heck is it compiling also my startup script at all?
  2. How can I fix this to just execute the main script?
I'm using Matlab R2014a with the corresponding MCR 8.3.

Risposta accettata

Harsheel
Harsheel il 17 Apr 2015
  1. The startup.m file is always included with the compiled application. This is to ensure that the behavior of MATLAB and the compiled application is same during the initialization phase.
  2. If you want some statements in the startup.m file to NOT execute when the compiled application is running then, wrap those statements under isdeployed . For your use case, I'd do:
if ~isdeployed
cd('/media/hdd/work/matlab')
end

Più risposte (0)

Categorie

Scopri di più su MATLAB Compiler in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by