- Are you saying the person who originally wrote the code, wrote it with a Mac and that you'd like to submit the code from your Windows 10 machine to a Linux cluster (not running on a Mac)?
- How do you plan to submit the job from your machine, with parpool or batch?
genpath subfolders slash the wrong way
18 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I am using the parallel toolbox to run code that has been developed on a Mac on a Unix cluster. I am using Windows 10 and want to set up the code from my machine to run on the Unix cluster.
The code starts to run locally like this:
%% Set Cluster
% Get a handle to the cluster
c = parcluster;
%define username
username = 'lf';
% Create a list of all the paths in repo and supplement it so that the
% files would be on path and could be read on Cluster
localPath1 = genpath(strcat('/Users/',username,'/Documents/MATLAB/repo/data'))
Having removed the ; after localPath1, I got:
localPath1 =
'/Users/lf/Documents/MATLAB/repo/data;\Users\franssel\Documents\MATLAB\repo\data\XXX'
This, I believe, makes the code buggy as it runs as the paths with different / vs \ throws error messages.
Just FYI: The code continues by replacing the local path by the remote path, i.e. like this if we had only 1 localPath (there are more in the real code):
cellLocalPath{1} = strrep(cellLocalPath{i},strcat('/Users/',username,'/Documents/MATLAB/'),strcat('/YYY/home/',username,'/'))
I am grateful on any advice on how to deal with this as I could not find a solution online.
Thank you and best wishes,
Linnéa
2 件のコメント
Raymond Norris
2020 年 8 月 16 日
Hi Linnea,
Can you clarify a couple of things:
I'm not sure where/how cellLocalPath is getting used, but when you call parpool/batch, you can specify additional folders (either on your machine or on the cluster) that can be added to your workers running on the cluster. This might be a slightly easier way to set paths, rather than embedded from within your code. Take a closer look at the command line arguements for parpool and batch for more information.
If not, look at fullfile if the code is being evaluated on the cluster. This will build up the folder with the appropriate file separators.
Raymond
採用された回答
Image Analyst
2020 年 8 月 16 日
Try this:
localPath1 = strrep(localPath1, '\', '/');
6 件のコメント
Walter Roberson
2022 年 3 月 21 日
The code is being executed on a non-Windows system, most likely a Mac (based on the directory name structure.) But the model includes code that uses \ as the separator.
You will need to edit the initFcn of block diagram vehicleModel and convert the reference to library\busDefinitions.m into a reference to library/busDefinitions.m . My speculation would be that the initFcn has a run() call coded in it.
Antonios Kouzelis
2022 年 3 月 22 日
Hi guys,
Indeed, I'm using a Macbook. @Walter Roberson I located the script that called the \ location and fixed it. Thanks to you both for the support! Very much appreciated.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!