How can I use a new toolbox when using MDCS?

Hi,
I am using Statistical Parametric Mapping (SPM) toolbox. I have to submit my job through MDCS to a cluster. I have asked the admin to add SPM to the MATLAB on the node. So they put it in the system and told me to add its path to the MATLAB session that opens on my own PC from the cluster node.
1. I did this the first time using file menu> set path and it asked where to save pathdef. I saved pathdef.m in a folder other than the one my data is in. So, everytime I closed my MATLAB session and opened it again, I had to add the path. Also, although the path was added to my session and I could call SPM in this open session, when I submitted my job to MDCS, it could not find SPM and gave me this error back: "Undefined function or variable 'spm'."
2. Then I tried adding the path using addpath function and saved pathdef.m inside the folder my data is in and when I closed the session and opened it again, SPM was there and I did not need to add it again but my second problem was not solved, i.e. I still get this error when I submit my job to MDCS: "Undefined function or variable 'spm'."
I asked the admin to add its path himself to all cluster nodes (I am not even sure if it is a reasonable suggestion) but I have not got any answers for that yet. Any suggestions?
Pegah

Risposte (2)

Jason Ross
Jason Ross il 4 Set 2012
Modificato: Jason Ross il 4 Set 2012
You might need to add it in the cluster profile under AdditionalPaths. Go into the parallel menu, select the cluster profile for your MDCS cluster, edit it, and add the paths to the toolbox in the "AdditionalPaths" field.
Pegah Hosseini
Pegah Hosseini il 4 Set 2012
Dear Jason,
I did what you told but I still have the same problem. I went to Parallel>manage configurations> Iridis (which is the configuration I am using)> double click on Iridis
Then another window opened which had three tabs scheduler, jobs, tasks. In the "jobs" tab, there were two windows for FileDependencies and PathDependencies and I added the path to this toolbox to both of these windows. I even added all the subfolders of this toolbox but still I get the same error.
"Undefined function or variable SPM for input argument type 'char'."
Best, Pegah

7 Commenti

Are the client and cluster nodes the same operating system? Could there be spaces in the paths that aren't being picked up?
Also, what's the location where the new toolbox gets installed? It looks like it's a toolbox developed outside of MathWorks, right?
Pegah Hosseini
Pegah Hosseini il 5 Set 2012
Modificato: Pegah Hosseini il 5 Set 2012
If by client you mean my system, then I use windows 7 and I am not sure about cluster nodes. But for submitting my job, I use a MATLAB session which is called from the cluster nodes so I think I am actually using the same system as cluster nodes even if it is not windows 7.
I just checked the paths again and there is not any spaces anywhere.
The cluster computing system of university is called Iridis. The toolbox had been put in a directory in Iridis to which I could only have access when I loaded MATLAB from the cluster nodes. But today, they told me that they have put it in my own Iridis account (home directory). So, I am going to try this path too. And yes, the toolbox has been developed outside Mathworks.
Jason,
1. I just added the new path (in my home directory) to MATLAB and again got the same error. I save the path both in manage configuration as you suggested and in command line as follows:
addpath(genpath('/home/pth1v10/spm8'))
savepath /home/pth1v10/matlab_files/pathdef.m
savepath ~/.matlab/R2011a/pathdef.m
But when I close the MATLAB session and open it again, the path is gone. It was not happening before, when SPM was not in my home directory. My .m files that call SPM are in the folder "matlab_files".
2. When I add additional paths to jobs in manage configuration and use the following two commands:
jm=findResource('scheduler','configuration','Iridis');
job=createJob(jm);
Shouldn't I see these paths in job.PathDependencies? I mean it seems that these paths have not been added to the job. Do you think I have to add all these paths (74 paths) using job.PathDependencies? It seems a bit strange to do it this way specially because the number of paths is too large.
You mention having an "iridis" account. Is there a separate account where you are doing the addpath/savepath/findResource or is that being done on the "iridis" account? Do you log into the "iridis" account on Windows, or do you have another user name on Windows? (e.g. phosseini)
You mention that you work on Windows, but the addpath looks like it's being done on UNIX. If there are two different user accounts at play here, it's possible that the paths are not being picked up because the settings are being saved in two different home directories.
Do you know how the jobs are being submitted to the scheduler? Do you log into a cluster node or submit right from Windows? Is the scheduler MDCS or is it something else (Torque, LSF, PBS, SGE, etc?)
I have installed Secure Shell Client (SSH) on my computer and through that, which is a linux environment, I connect to iridis account and for that I have to enter a username (pth1v10 as you can see in the save path above) and password. Through this SSH, I will call MATLAB which is actually being called from one of the cluster nodes as I explained before. So, when I work in this MATLAB session, I am actually working on one of the nodes and now I have to submit my job through MDCS.
Although my previous suggestion (adding all paths using job.PathDependencies) seems a bit strange, I did it anyway and now it identifies SPM and it seems that it is actually working now.
It's good to hear that progress is being made!
It sounds like you do have two user IDs at play here, one on your Windows 7 machine and another on the cluster.
When you are looking at the Iridis configuration through Windows (I'm assuming it's type "jobmanager"), is the "pth1v10" username filled in, or is it blank? If it's not, you are likely connecting to the cluster using some other user ID, and therefore it's not finding your home directory (~) and other information.
A quick way you can see what's going on is as follows:
matlabpool Iridis open 1
(an interactive matlabpool should open using the "Iridis" cluster with one worker)
spmd
system('whoami')
end
You should now see which user name is in use. This might offer a clue as to why these changes aren't being picked up on the cluster.
You can also try other MATLAB commands inside the spmd block -- checking your path, seeing if your function are there, etc. Hopefully this will help you get things working correctly.

Accedi per commentare.

Categorie

Scopri di più su MATLAB Parallel Server in Centro assistenza e File Exchange

Richiesto:

il 4 Set 2012

Community Treasure Hunt

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

Start Hunting!

Translated by