-
Notifications
You must be signed in to change notification settings - Fork 0
Compiled workers - Herbert changes #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,9 +172,18 @@ function check_availability(obj) | |
| rootpath = fileparts(which('herbert_init')); | ||
| external_dll_dir = fullfile(rootpath, 'DLL','external'); | ||
| if ispc() | ||
| % only one version of mpiexec is used now. May change in the | ||
| % future. | ||
| mpi_exec = fullfile(external_dll_dir, 'mpiexec.exe'); | ||
| [rs, rv] = system('where mpiexec'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am concern about this logic. I have seed three MS I would try to run worker under internal mpiexec if it is possible and there are no compelling reason to try external mpi first.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested it with MSMPI v8, MSMPI v9 and MSMPI v10 and it works on all 3 with the Jenkins compiled I think that the The issue with the Horace-bundled |
||
| mpis = splitlines(strip(rv)); | ||
| % Ignore Matlab-bundled mpiexec (firewall issues) | ||
| mpis(cellfun(@(x) contains(x, matlabroot), mpis)) = []; | ||
| if rs == 0 && ~isempty(mpis) | ||
| % If multiple mpiexec on path, prefer user installed MS MPI | ||
| mpi_id = [1 find(cellfun(@(x) contains(x,'Microsoft'), mpis), 1)]; | ||
| mpi_exec = mpis{max(mpi_id)}; | ||
| else | ||
| % No mpiexec on path, use pre-packaged version | ||
| mpi_exec = fullfile(external_dll_dir, 'mpiexec.exe'); | ||
| end | ||
| else | ||
| mpi_exec = fullfile(external_dll_dir, 'mpiexec'); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,13 +7,11 @@ | |
| % The cluster name (can be defined by single symbol) | ||
| % or by a cluster number in the list of clusters | ||
| % | ||
| wrkr = which(obj.worker_); | ||
| mff = MPI_clusters_factory.instance(); | ||
| assert(~isempty(which(obj.worker)) || exist(obj.worker, 'file'), ... | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code seems duplicated 3x is it worth making it a function?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah... maybe... it's just it's in three different classes... :/ |
||
| 'HERBERT:parallel_config:not_available', ... | ||
| 'Parallel worker is not on the Matlab path so parallel features are not available'); | ||
|
|
||
| if isempty(wrkr) | ||
| error('HERBERT:parallel_config:not_available',... | ||
| 'Parallel worker is not on the Matlab path so parallel features are not available') | ||
| else | ||
| mff = MPI_clusters_factory.instance(); | ||
| known_clusters = mff.known_cluster_names; | ||
| full_cl_name = obj.select_option(known_clusters,cluster_name); | ||
| mff.parallel_cluster = full_cl_name; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,16 @@ | |
| 'The worker property needs the executable script name') | ||
| end | ||
| scr_path = which(new_wrkr); | ||
| config_instance = config_store.instance(); | ||
| if isempty(scr_path) | ||
| % Check if it is a compiled worker | ||
| compiled_wrkr = check_compiled_(new_wrkr); | ||
| if ~isempty(compiled_wrkr) | ||
| config_instance.store_config(obj, 'worker', new_wrkr); | ||
| config_instance.store_config(obj, 'is_compiled', true); | ||
| return | ||
| end | ||
|
|
||
| def_wrkr = obj.worker_; | ||
| if strcmp(new_wrkr,def_wrkr) | ||
| cur_fmw = get_or_restore_field(obj,'parallel_cluster'); | ||
|
|
@@ -18,12 +27,12 @@ | |
| 'to all running Matlab sessions but parallel config can not find it.',... | ||
| ' Parallel extensions are disabled'],... | ||
| new_wrkr) | ||
| config_store.instance().store_config(obj,... | ||
| config_instance.store_config(obj,... | ||
| 'parallel_cluster','none','cluster_config','none'); | ||
|
|
||
| end | ||
| else | ||
| config_store.instance().store_config(obj,'worker',def_wrkr); | ||
| config_instance.store_config(obj,'worker',def_wrkr); | ||
| error('PARALLEL_CONFIG:invalid_argument',... | ||
| ['The script to run in parallel (%s) should be available ',... | ||
| 'to all running Matlab sessions but parallel config can not find it.',... | ||
|
|
@@ -32,6 +41,27 @@ | |
|
|
||
| end | ||
| else % worker function is available. | ||
| config_store.instance().store_config(obj,'worker',new_wrkr); | ||
| config_instance.store_config(obj, 'worker', new_wrkr); | ||
| config_instance.store_config(obj, 'is_compiled', false); | ||
| end | ||
| end % function | ||
|
|
||
| function out = check_compiled_(worker) | ||
| out = ''; | ||
| if is_file(worker) && ~endsWith(worker, '.m') | ||
| % Assume if input is full path to file, then it is a compiled worker | ||
| out = worker; | ||
| else | ||
mducle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if ispc() | ||
| cmd = 'where'; | ||
| else | ||
| cmd = 'which'; | ||
| end | ||
| [rs, rv] = system([cmd ' ' worker]); | ||
| if rs == 0 | ||
| % Assume if it is on the system path, then it is a compiled worker | ||
| out = splitlines(strip(rv)); | ||
| out = out{1}; % Only take first path if there is more than one | ||
| end | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rather distinguish between compiled and Matlab worker on extension. The Matlab worker would be
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this bit is to allow a user shortcut because what we want is the fully qualified path to pass to the Java |
||
| end | ||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.