-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlgorithmMPISupport.html
1181 lines (1133 loc) · 89.2 KB
/
AlgorithmMPISupport.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>MPI Support for Algorithms</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css" />
<link rel="stylesheet" type="text/css" href="_static/custom.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Batch Widget Manual" href="BatchWidget/index.html" />
<link rel="prev" title="Project Save" href="Workbench/ProjectSaveInterfaces.html" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59110517-1', 'auto');
ga('send', 'pageview');
</script>
</head><body>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://www.mantidproject.org">
</a>
<span class="navbar-text navbar-version pull-left"><b>master</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="divider-vertical"></li>
<li><a href="index.html">Home</a></li>
<li><a href="https://download.mantidproject.org">Download</a></li>
<li><a href="https://docs.mantidproject.org">User Documentation</a></li>
<li><a href="http://www.mantidproject.org/contact">Contact Us</a></li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<p>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="index.html">Documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">MPI Support for Algorithms</a></li>
</ul>
</div> </p>
</div>
<div class="container">
<div class="row">
<div class="body col-md-12 content" role="main">
<section id="mpi-support-for-algorithms">
<span id="algorithmmpisupport"></span><h1>MPI Support for Algorithms<a class="headerlink" href="#mpi-support-for-algorithms" title="Permalink to this heading">¶</a></h1>
<nav class="contents local" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#concept" id="id12">Concept</a></p>
<ul>
<li><p><a class="reference internal" href="#introduction" id="id13">Introduction</a></p></li>
<li><p><a class="reference internal" href="#spectrum-and-detector" id="id14">Spectrum and Detector</a></p></li>
<li><p><a class="reference internal" href="#storage-mode" id="id15">Storage Mode</a></p></li>
<li><p><a class="reference internal" href="#execution-mode" id="id16">Execution Mode</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#building-and-running-mantid-with-mpi-support" id="id17">Building and Running Mantid with MPI Support</a></p>
<ul>
<li><p><a class="reference internal" href="#build-with-mpi-support" id="id18">Build with MPI support</a></p></li>
<li><p><a class="reference internal" href="#configuration" id="id19">Configuration</a></p></li>
<li><p><a class="reference internal" href="#writing-and-running-python-scripts" id="id20">Writing and running Python scripts</a></p></li>
<li><p><a class="reference internal" href="#logging-output" id="id21">Logging output</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#implementing-mpi-support-for-an-algorithm" id="id22">Implementing MPI Support for an Algorithm</a></p>
<ul>
<li><p><a class="reference internal" href="#supported-workspace-types" id="id23">Supported workspace types</a></p></li>
<li><p><a class="reference internal" href="#mechanism" id="id24">Mechanism</a></p></li>
<li><p><a class="reference internal" href="#identical-execution" id="id25">Identical execution</a></p></li>
<li><p><a class="reference internal" href="#distributed-execution" id="id26">Distributed execution</a></p></li>
<li><p><a class="reference internal" href="#master-only-execution" id="id27">Master-only execution</a></p></li>
<li><p><a class="reference internal" href="#setting-spectrum-numbers" id="id28">Setting spectrum numbers</a></p></li>
<li><p><a class="reference internal" href="#workspace-indices" id="id29">Workspace indices</a></p></li>
<li><p><a class="reference internal" href="#instrument-and-detectors" id="id30">Instrument and detectors</a></p></li>
<li><p><a class="reference internal" href="#gui" id="id31">GUI</a></p></li>
<li><p><a class="reference internal" href="#units-tests" id="id32">Units Tests</a></p></li>
<li><p><a class="reference internal" href="#documentation" id="id33">Documentation</a></p></li>
<li><p><a class="reference internal" href="#porting-python-reduction-scripts-in-practice" id="id34">Porting Python reduction scripts in practice</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#supported-algorithms" id="id35">Supported Algorithms</a></p></li>
</ul>
</nav>
<section id="concept">
<h2><a class="toc-backref" href="#id12" role="doc-backlink">Concept</a><a class="headerlink" href="#concept" title="Permalink to this heading">¶</a></h2>
<section id="introduction">
<h3><a class="toc-backref" href="#id13" role="doc-backlink">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this heading">¶</a></h3>
<p>MPI support in Mantid is based on processing a subset of spectra on each MPI rank.
Many algorithms process each spectrum independently so this is an efficient way of splitting the computational effort and data volume.</p>
<p>Note that the multi-dimensional workspaces <code class="docutils literal notranslate"><span class="pre">MDHistoWorkspace</span></code> and <code class="docutils literal notranslate"><span class="pre">MDEventWorkspace</span></code> handle data differently and thus cannot be dealt with in this way.
MPI support for these multi-dimensional workspaces is beyond the scope of this document.</p>
</section>
<section id="spectrum-and-detector">
<h3><a class="toc-backref" href="#id14" role="doc-backlink">Spectrum and Detector</a><a class="headerlink" href="#spectrum-and-detector" title="Permalink to this heading">¶</a></h3>
<p>In Mantid the terms spectrum and detector are used interchangeably at times, leading to confusion.
In particular, it is sometimes assumed that there is a 1:1 correspondence between spectra and detectors.
It is important to clearly distinguish between a spectrum and a detector, especially in the context of MPI support.
We may define the terms as follows:</p>
<ul class="simple">
<li><p>A <strong>detector</strong> is a single pixel of the instrument. Data obtained from it may be used to create a list or histogram of neutron events. If the detector can move, it can contribute to more than one list or histogram of neutron events.</p></li>
<li><p>A <strong>spectrum</strong> is a list or histogram of neutron events collected in a specific region of (typically) space. The data contained in the spectrum is data obtained from on one or more detectors.</p></li>
</ul>
<p>Examples may help to clarify this:</p>
<ul class="simple">
<li><p>If the detectors are not moveable, a 1:1 mapping is the most common.</p></li>
<li><p>Some beamlines at ISIS group multiple detectors into a single spectrum, so the region of space corresponding to a spectrum is larger than a single detector pixel.</p></li>
<li><p>After running algorithms like <code class="docutils literal notranslate"><span class="pre">SumSpectra</span></code> or <code class="docutils literal notranslate"><span class="pre">DiffractionFocussing</span></code>, a spectrum will contain data from more than one detector, even if there was an initial 1:1 correspondence.</p></li>
<li><p>If the detectors are moveable, a spectrum would correspond to a region of space given by the position a specific detector had in a certain time interval.</p></li>
<li><p>There can be detectors without a corresponding spectrum, and Mantid is thus not handling data of those detectors.</p></li>
</ul>
<p>For the purpose of MPI support, Mantid always stores the complete instrument including <strong>all detectors</strong> on <strong>every MPI rank</strong>. <a class="footnote-reference brackets" href="#split-instrument" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>
Only a subset of all spectra is stored on the local MPI rank, so a detector may be locally without corresponding spectrum but have a spectrum associated to it on another MPI rank.</p>
</section>
<section id="storage-mode">
<h3><a class="toc-backref" href="#id15" role="doc-backlink">Storage Mode</a><a class="headerlink" href="#storage-mode" title="Permalink to this heading">¶</a></h3>
<figure class="align-right" id="id4" style="width: 25%">
<img alt="_images/MPI-storage-modes.png" src="_images/MPI-storage-modes.png" />
<figcaption>
<p><span class="caption-text">Visualization of available storage modes. In this and the following figures a vertical column is used to depict an MPI rank.</span><a class="headerlink" href="#id4" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<p>Not all data in an MPI-based data reduction can be or has to be distributed.
Some data may be present on all ranks or only on a single rank.
To formalize this concept a <code class="docutils literal notranslate"><span class="pre">Workspace</span></code> in Mantid now has an associated storage mode (<code class="docutils literal notranslate"><span class="pre">Parallel::StorageMode</span></code>), as visualized in the figure on the right.
The storage mode of a workspace can be obtained by calling <code class="docutils literal notranslate"><span class="pre">Workspace::storageMode()</span></code>.
There are three available storage modes</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code> implies that the data is not split and each rank holds a complete and identical clone.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code> implies that each rank holds a subset of the data and that the combination of all subsets gives the full data.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code> implies that only the master rank (rank 0) has the data.</p></li>
</ul>
<p>Currently only workspaces have an associated storage mode.
For all other data, such as a scalar value provided as an input to an algorithm are implicitly assumed to have <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code>, i.e., have the same value on all MPI ranks.</p>
<p>Usage examples for the storage modes could include:</p>
<ul class="simple">
<li><p>A workspace containing the neutron monitors could be used for normalization on all ranks and could use <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code>.</p></li>
<li><p>A workspace containing the data for all detector pixels would usually use <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code>.</p></li>
<li><p>A workspace containing the result of summing all spectra, such as obtained from <code class="docutils literal notranslate"><span class="pre">DiffractionFocussing</span></code> would usually use <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code>.</p></li>
</ul>
</section>
<section id="execution-mode">
<h3><a class="toc-backref" href="#id16" role="doc-backlink">Execution Mode</a><a class="headerlink" href="#execution-mode" title="Permalink to this heading">¶</a></h3>
<figure class="align-right" id="id5" style="width: 25%">
<img alt="_images/MPI-execution-mode-identical.png" src="_images/MPI-execution-mode-identical.png" />
<figcaption>
<p><span class="caption-text"><code class="docutils literal notranslate"><span class="pre">ExecutionMode::Identical</span></code> based on an input and output workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code>. Example: <code class="docutils literal notranslate"><span class="pre">ConvertUnits</span></code>, <code class="docutils literal notranslate"><span class="pre">Rebin</span></code>, or many other algorithm that do not load or save data.</span><a class="headerlink" href="#id5" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<figure class="align-right" id="id6" style="width: 25%">
<img alt="_images/MPI-execution-mode-distributed-load.png" src="_images/MPI-execution-mode-distributed-load.png" />
<figcaption>
<p><span class="caption-text"><code class="docutils literal notranslate"><span class="pre">ExecutionMode::Distributed</span></code> creating an output workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code>. Example: <code class="docutils literal notranslate"><span class="pre">LoadEventNexus</span></code>.</span><a class="headerlink" href="#id6" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<figure class="align-right" id="id7" style="width: 25%">
<img alt="_images/MPI-execution-mode-distributed.png" src="_images/MPI-execution-mode-distributed.png" />
<figcaption>
<p><span class="caption-text"><code class="docutils literal notranslate"><span class="pre">ExecutionMode::Distributed</span></code> based on an input and output workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code>. Example: <code class="docutils literal notranslate"><span class="pre">ConvertUnits</span></code> or <code class="docutils literal notranslate"><span class="pre">Rebin</span></code>.</span><a class="headerlink" href="#id7" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<figure class="align-right" id="id8" style="width: 25%">
<img alt="_images/MPI-execution-mode-distributed-gather.png" src="_images/MPI-execution-mode-distributed-gather.png" />
<figcaption>
<p><span class="caption-text"><code class="docutils literal notranslate"><span class="pre">ExecutionMode::Distributed</span></code> based on an input workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code> creating an output workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code>. Example: <code class="docutils literal notranslate"><span class="pre">DiffractionFocussing</span></code>.</span><a class="headerlink" href="#id8" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<figure class="align-right" id="id9" style="width: 25%">
<img alt="_images/MPI-execution-mode-master-only-load.png" src="_images/MPI-execution-mode-master-only-load.png" />
<figcaption>
<p><span class="caption-text"><code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> creating an output workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code>. Example: <code class="docutils literal notranslate"><span class="pre">LoadEventNexus</span></code> or other load algorithms.</span><a class="headerlink" href="#id9" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<figure class="align-right" id="id10" style="width: 25%">
<img alt="_images/MPI-execution-mode-master-only.png" src="_images/MPI-execution-mode-master-only.png" />
<figcaption>
<p><span class="caption-text"><code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> based on an input and output workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code>. Example: <code class="docutils literal notranslate"><span class="pre">ConvertUnits</span></code>, <code class="docutils literal notranslate"><span class="pre">Rebin</span></code>, or many other algorithm that do not load or save data.</span><a class="headerlink" href="#id10" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<figure class="align-right" id="id11" style="width: 25%">
<img alt="_images/MPI-execution-mode-master-only-store.png" src="_images/MPI-execution-mode-master-only-store.png" />
<figcaption>
<p><span class="caption-text"><code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> based on an input workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code> an no output. Example: <code class="docutils literal notranslate"><span class="pre">Save</span></code> or any other save algorithm.</span><a class="headerlink" href="#id11" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<p>Just like the storage mode describes how data is stored, and execution mode describes how an algorithm is executed on this data.
There are five execution modes (in namespace <code class="docutils literal notranslate"><span class="pre">Parallel</span></code>):</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">ExecutionMode::Invalid</span></code> is used to indicate that execution is not possible, e.g., if the storage modes of the inputs are inconsistent.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ExecutionMode::Serial</span></code> is used for serial execution, i.e., in non-MPI builds of Mantid or if there is only a single MPI rank. Having this mode allows for running algorithms that do not support MPI in MPI builds by running only with a single MPI rank.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ExecutionMode::Identical</span></code> is used for running an algorithm in an identical way on all MPI ranks. This would typically be used if the input workspaces have <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ExecutionMode::Distributed</span></code> is used for running an algorithm in a distributed way across all MPI ranks. This would typically be used if the input workspaces have <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> is typically used for running an algorithm if the input workspaces have <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code>.</p></li>
</ul>
<p>The use of the word ‘typically’ above is intentional and indicates that there may be other cases.
In particular, an algorithm may cause a transition from one storage mode to another, or may take inputs with different storage modes.
Examples are given in the series of figures on the right.</p>
</section>
</section>
<section id="building-and-running-mantid-with-mpi-support">
<h2><a class="toc-backref" href="#id17" role="doc-backlink">Building and Running Mantid with MPI Support</a><a class="headerlink" href="#building-and-running-mantid-with-mpi-support" title="Permalink to this heading">¶</a></h2>
<p>Firstly, you may also need to check out <a class="reference external" href="https://docs.mantidproject.org/nightly/concepts/PythonNotebook.html#pythonnotebook" title="(in MantidProject v6.6)"><span>Access Mantid in Python and Notebook</span></a>.</p>
<section id="build-with-mpi-support">
<h3><a class="toc-backref" href="#id18" role="doc-backlink">Build with MPI support</a><a class="headerlink" href="#build-with-mpi-support" title="Permalink to this heading">¶</a></h3>
<p>To build Mantid with MPI support as described in this document run <code class="docutils literal notranslate"><span class="pre">cmake</span></code> with the additional option <code class="docutils literal notranslate"><span class="pre">-DMPI_EXPERIMENTAL=ON</span></code>.
This requires <code class="docutils literal notranslate"><span class="pre">boost-mpi</span></code> and a working MPI installation.</p>
</section>
<section id="configuration">
<h3><a class="toc-backref" href="#id19" role="doc-backlink">Configuration</a><a class="headerlink" href="#configuration" title="Permalink to this heading">¶</a></h3>
<p>To avoid unintentional DDOSing or potential other issues, there is no MPI support for <code class="docutils literal notranslate"><span class="pre">DownloadInstrument</span></code> and <code class="docutils literal notranslate"><span class="pre">CheckMantidVersion</span></code>.
Error messages can be avoided by disabling these startup checks in the configuration.
Furthermore, to avoid pollution of usage reports, usage reporting should be disabled:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>UpdateInstrumentDefinitions.OnStartup<span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0</span>
CheckMantidVersion.OnStartup<span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0</span>
usagereports.enabled<span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0</span>
</pre></div>
</div>
</section>
<section id="writing-and-running-python-scripts">
<h3><a class="toc-backref" href="#id20" role="doc-backlink">Writing and running Python scripts</a><a class="headerlink" href="#writing-and-running-python-scripts" title="Permalink to this heading">¶</a></h3>
<p>In principle Python scripts that use only algorithms that support MPI can be run with MPI <strong>without changes</strong>.
For example:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">mantid.simpleapi</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">dataX</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]</span>
<span class="n">dataY</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span>
<span class="n">dataE</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span>
<span class="c1"># CreateWorkspace has a new property called ParallelStorageMode that allows setting the</span>
<span class="c1"># desired storage mode. It defaults to "Parallel::StorageMode::Cloned".</span>
<span class="n">dataWS</span> <span class="o">=</span> <span class="n">CreateWorkspace</span><span class="p">(</span><span class="n">DataX</span><span class="o">=</span><span class="n">dataX</span><span class="p">,</span> <span class="n">DataY</span><span class="o">=</span><span class="n">dataY</span><span class="p">,</span> <span class="n">DataE</span><span class="o">=</span><span class="n">dataE</span><span class="p">,</span> <span class="n">NSpec</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="n">UnitX</span><span class="o">=</span><span class="s2">"Wavelength"</span><span class="p">,</span> <span class="n">ParallelStorageMode</span><span class="o">=</span><span class="s2">"Parallel::StorageMode::Distributed"</span><span class="p">)</span>
<span class="n">ws</span> <span class="o">=</span> <span class="n">Rebin</span><span class="p">(</span><span class="n">dataWS</span><span class="p">,</span> <span class="s2">"1,1,7"</span><span class="p">);</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">"Histograms: "</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">ws</span><span class="o">.</span><span class="n">getNumberHistograms</span><span class="p">()))</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">ws</span><span class="o">.</span><span class="n">getNumberHistograms</span><span class="p">()):</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">"(Local) workspace index: "</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ws</span><span class="o">.</span><span class="n">readX</span><span class="p">(</span><span class="n">i</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ws</span><span class="o">.</span><span class="n">readY</span><span class="p">(</span><span class="n">i</span><span class="p">))</span>
</pre></div>
</div>
<p>Run Python with <code class="docutils literal notranslate"><span class="pre">mpirun</span></code> and the desired number of MPI ranks, by using the <code class="docutils literal notranslate"><span class="pre">-np</span></code> flag to <code class="docutils literal notranslate"><span class="pre">python</span></code>:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>mpirun<span class="w"> </span>-np<span class="w"> </span><span class="m">3</span><span class="w"> </span>python<span class="w"> </span>test.py
</pre></div>
</div>
<p>Possible output:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>CreateWorkspace-<span class="o">[</span>Notice<span class="o">]</span><span class="w"> </span>CreateWorkspace<span class="w"> </span>started
CreateWorkspace-<span class="o">[</span>Notice<span class="o">]</span><span class="w"> </span>CreateWorkspace<span class="w"> </span>successful,<span class="w"> </span>Duration<span class="w"> </span><span class="m">0</span>.02<span class="w"> </span>seconds
Rebin-<span class="o">[</span>Notice<span class="o">]</span><span class="w"> </span>Rebin<span class="w"> </span>started
Rebin-<span class="o">[</span>Notice<span class="o">]</span><span class="w"> </span>Rebin<span class="w"> </span>successful,<span class="w"> </span>Duration<span class="w"> </span><span class="m">0</span>.01<span class="w"> </span>seconds
Histograms:<span class="w"> </span><span class="m">2</span>
<span class="o">(</span>Local<span class="o">)</span><span class="w"> </span>workspace<span class="w"> </span>index:<span class="w"> </span><span class="m">0</span>
<span class="o">[</span><span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">2</span>.<span class="w"> </span><span class="m">3</span>.<span class="w"> </span><span class="m">4</span>.<span class="w"> </span><span class="m">5</span>.<span class="w"> </span><span class="m">6</span>.<span class="w"> </span><span class="m">7</span>.<span class="o">]</span>
<span class="o">[</span><span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">0</span>.<span class="o">]</span>
<span class="o">(</span>Local<span class="o">)</span><span class="w"> </span>workspace<span class="w"> </span>index:<span class="w"> </span><span class="m">1</span>
<span class="o">[</span><span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">2</span>.<span class="w"> </span><span class="m">3</span>.<span class="w"> </span><span class="m">4</span>.<span class="w"> </span><span class="m">5</span>.<span class="w"> </span><span class="m">6</span>.<span class="w"> </span><span class="m">7</span>.<span class="o">]</span>
<span class="o">[</span><span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">1</span>.<span class="o">]</span>
Histograms:<span class="w"> </span><span class="m">1</span>
<span class="o">(</span>Local<span class="o">)</span><span class="w"> </span>workspace<span class="w"> </span>index:<span class="w"> </span><span class="m">0</span>
<span class="o">[</span><span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">2</span>.<span class="w"> </span><span class="m">3</span>.<span class="w"> </span><span class="m">4</span>.<span class="w"> </span><span class="m">5</span>.<span class="w"> </span><span class="m">6</span>.<span class="w"> </span><span class="m">7</span>.<span class="o">]</span>
<span class="o">[</span><span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">0</span>.<span class="o">]</span>
Histograms:<span class="w"> </span><span class="m">1</span>
<span class="o">(</span>Local<span class="o">)</span><span class="w"> </span>workspace<span class="w"> </span>index:<span class="w"> </span><span class="m">0</span>
<span class="o">[</span><span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">2</span>.<span class="w"> </span><span class="m">3</span>.<span class="w"> </span><span class="m">4</span>.<span class="w"> </span><span class="m">5</span>.<span class="w"> </span><span class="m">6</span>.<span class="w"> </span><span class="m">7</span>.<span class="o">]</span>
<span class="o">[</span><span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">0</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">1</span>.<span class="w"> </span><span class="m">0</span>.<span class="o">]</span>
</pre></div>
</div>
<p>Output involving the local number of histograms and local indices is obviously not useful for users and should be avoided (see also the section on workspace indices), this example is merely for illustration.</p>
<p>Note that currently Mantid does not support workspaces without spectra, so running above example with more than four MPI ranks fill fail since there are only four spectra.
This is probably not a problem in practice.</p>
</section>
<section id="logging-output">
<h3><a class="toc-backref" href="#id21" role="doc-backlink">Logging output</a><a class="headerlink" href="#logging-output" title="Permalink to this heading">¶</a></h3>
<p>With many MPI ranks it is common to get spammed by logging output.
Since there is not control of output order for multi-line log messages it also tends to become hard to read since output from different ranks get interleaved.</p>
<p>The current solution to this is a logging offset for all but the master rank.
By default an offset of 1 is added, i.e., an error message from any rank but rank 0 will be displayed as a warning.
The offset can be adjusted in the Mantid properties file, e.g.,</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>mpi.loggingOffset<span class="o">=</span><span class="m">3</span>
</pre></div>
</div>
<p>The drawback of this approach is that information contained in error or warning messages that are specific to a spectrum, such as a missing detector ID, can be hidden or lost.
If that is an issue the logging offset can simply be set to 0.</p>
</section>
</section>
<section id="implementing-mpi-support-for-an-algorithm">
<h2><a class="toc-backref" href="#id22" role="doc-backlink">Implementing MPI Support for an Algorithm</a><a class="headerlink" href="#implementing-mpi-support-for-an-algorithm" title="Permalink to this heading">¶</a></h2>
<section id="supported-workspace-types">
<h3><a class="toc-backref" href="#id23" role="doc-backlink">Supported workspace types</a><a class="headerlink" href="#supported-workspace-types" title="Permalink to this heading">¶</a></h3>
<p>Only <code class="docutils literal notranslate"><span class="pre">MatrixWorkspace</span></code> and its subclasses support <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code>.
All other workspace types, in particular <code class="docutils literal notranslate"><span class="pre">TableWorkspace</span></code> and <code class="docutils literal notranslate"><span class="pre">MDWorkspace</span></code> are restricted to <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code> and <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code>.</p>
</section>
<section id="mechanism">
<h3><a class="toc-backref" href="#id24" role="doc-backlink">Mechanism</a><a class="headerlink" href="#mechanism" title="Permalink to this heading">¶</a></h3>
<p>By default an algorithm does not support MPI and any attempt to execute it in an MPI run will throw an exception.
MPI support for an algorithm is implemented by means of a couple of virtual methods in the <code class="docutils literal notranslate"><span class="pre">Algorithm</span></code> base class:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">Algorithm</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">// ...</span>
<span class="k">protected</span><span class="o">:</span>
<span class="w"> </span><span class="k">virtual</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="n">execDistributed</span><span class="p">();</span>
<span class="w"> </span><span class="k">virtual</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="nf">execMasterOnly</span><span class="p">();</span>
<span class="w"> </span><span class="k">virtual</span><span class="w"> </span><span class="n">Parallel</span><span class="o">::</span><span class="n">ExecutionMode</span><span class="w"> </span><span class="nf">getParallelExecutionMode</span><span class="p">(</span>
<span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">map</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="n">Parallel</span><span class="o">::</span><span class="n">StorageMode</span><span class="o">></span><span class="w"> </span><span class="o">&</span><span class="n">storageModes</span><span class="p">)</span><span class="w"> </span><span class="k">const</span><span class="p">;</span>
<span class="w"> </span><span class="c1">// ...</span>
<span class="p">};</span>
</pre></div>
</div>
<p>In general it is <strong>not</strong> necessary to implement all of these methods.
For many algorithms it can be sufficient to implement <code class="docutils literal notranslate"><span class="pre">getParallelExecutionMode</span></code>.
This is often the case if an algorithm has only a single input and a single output and treats all spectra independently.
In that case the execution mode can simply be determined from the input workspace as follows:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">Parallel</span><span class="o">::</span><span class="n">ExecutionMode</span><span class="w"> </span><span class="nf">MyAlg::getParallelExecutionMode</span><span class="p">(</span>
<span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">map</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="n">Parallel</span><span class="o">::</span><span class="n">StorageMode</span><span class="o">></span><span class="w"> </span><span class="o">&</span><span class="n">storageModes</span><span class="p">)</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">// The map key is the property name. If there is only one input workspace it can usually be ignored.</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">Parallel</span><span class="o">::</span><span class="n">getCorrespondingExecutionMode</span><span class="p">(</span><span class="n">storageModes</span><span class="p">.</span><span class="n">begin</span><span class="p">()</span><span class="o">-></span><span class="n">second</span><span class="p">);</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Here the helper <code class="docutils literal notranslate"><span class="pre">Parallel::getCorrespondingExecutionMode</span></code> is used to obtain the ‘natural’ execution mode from a storage mode, i.e., <code class="docutils literal notranslate"><span class="pre">ExecutionMode::Identical</span></code> for <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code>, <code class="docutils literal notranslate"><span class="pre">ExecutionMode::Distributed</span></code> for <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code>, and <code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> for <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code>.
More complex algorithms may require more complex decision mechanism, e.g., when there is more than one input workspace.</p>
<p>For many algorithms a sufficient default implementation of <code class="docutils literal notranslate"><span class="pre">Algorithm::getParallelExecutionMode()</span></code> is provided by one of the base classes <code class="docutils literal notranslate"><span class="pre">API::SerialAlgorithm</span></code>, <code class="docutils literal notranslate"><span class="pre">API::ParallelAlgorithm</span></code>, or <code class="docutils literal notranslate"><span class="pre">API::DistributedAlgorithm</span></code>.
MPI support can simply be enabled by inheriting from one of these instead of from <code class="docutils literal notranslate"><span class="pre">Algorithm</span></code>.
The level of thereby enabled MPI support is as follows:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">API::SerialAlgorithm</span></code> supports only <code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">API::ParallelAlgorithm</span></code> supports parallel execution, but not distributed execution, i.e., <code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> and <code class="docutils literal notranslate"><span class="pre">ExecutionMode::IdenticalOnly</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">API::DistributedAlgorithm</span></code> supports distributed execution, i.e., <code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code>, <code class="docutils literal notranslate"><span class="pre">ExecutionMode::IdenticalOnly</span></code>, and <code class="docutils literal notranslate"><span class="pre">ExecutionMode::Distributed</span></code>.</p></li>
</ul>
<p>In the latter two cases more than one execution mode is supported.
Thus this usually works only for algorithms with a single input (and a single output) such that the execution mode can be uniquely derived from the storage mode of the input workpace.
Multiple inputs are also supported to a certain extent. For example, for <code class="docutils literal notranslate"><span class="pre">API::DistributedAlgorithm</span></code> the storage modes of the inputs can be mixed if they are compatible, such as <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code> with <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code> (resulting in <code class="docutils literal notranslate"><span class="pre">ExecutionMode::Distributed</span></code>).</p>
<p>If none of the other virtual methods listed above is implemented, <code class="docutils literal notranslate"><span class="pre">Algorithm</span></code> will run the normal <code class="docutils literal notranslate"><span class="pre">exec()</span></code> method on all MPI ranks.
The exception are non-master ranks if the execution mode is <code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> – in that case creating a dummy workspace is attempted.
This is discussed in more detail in the subsections below.</p>
</section>
<section id="identical-execution">
<h3><a class="toc-backref" href="#id25" role="doc-backlink">Identical execution</a><a class="headerlink" href="#identical-execution" title="Permalink to this heading">¶</a></h3>
<p>Identical execution with execution mode <code class="docutils literal notranslate"><span class="pre">ExecutionMode::Identical</span></code> is usually done for data with storage mode <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code>.
Execution is handled by simply calling <code class="docutils literal notranslate"><span class="pre">Algorithm::exec()</span></code> on all MPI ranks.</p>
<p>A notable exception that has to be kept in mind are algorithms that are saving workspaces or write to other resources, since the file names will be in conflict.</p>
</section>
<section id="distributed-execution">
<h3><a class="toc-backref" href="#id26" role="doc-backlink">Distributed execution</a><a class="headerlink" href="#distributed-execution" title="Permalink to this heading">¶</a></h3>
<p>Distributed execution is handled by <code class="docutils literal notranslate"><span class="pre">Algorithm::execDistributed()</span></code>.
By default this simply calls <code class="docutils literal notranslate"><span class="pre">Algorithm::exec()</span></code>.
In many cases this may be perfectly fine and more convenient than reimplementing <code class="docutils literal notranslate"><span class="pre">Algorithm::execDistributed()</span></code>.</p>
<p>The following example illustrates the difference.
We can either check for the number of MPI ranks in the normal <code class="docutils literal notranslate"><span class="pre">exec()</span></code> method:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="nf">MyAlg::exec</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">//// Algorithm logics, e.g., a sum over all spectra ////</span>
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">communicator</span><span class="p">.</span><span class="n">size</span><span class="p">()</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">//// MPI calls, e.g., a global sum ////</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Alternatively, we can implement <code class="docutils literal notranslate"><span class="pre">Algorithm::execDistributed()</span></code>:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="nf">MyAlg::exec</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">//// Algorithm logics ////</span>
<span class="p">}</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">MyAlg::execDistributed</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">//// Algorithm logics but in a very different way ////</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Many algorithms in Mantid will require very little modification for MPI support and thus the first option is likely to be the first choice.</p>
</section>
<section id="master-only-execution">
<h3><a class="toc-backref" href="#id27" role="doc-backlink">Master-only execution</a><a class="headerlink" href="#master-only-execution" title="Permalink to this heading">¶</a></h3>
<p>Master-only execution is handled by <code class="docutils literal notranslate"><span class="pre">Algorithm::execMasterOnly()</span></code>.
By default this simply calls <code class="docutils literal notranslate"><span class="pre">Algorithm::exec()</span></code> on rank 0 and does nothing on all other ranks.</p>
<p>To support running existing Python scripts without significant modification, and to be able to automatically determine execution modes based on input workspaces, workspaces with storage mode <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code> also exist on the non-master ranks.</p>
<p>Given that no algorithm execution happens on non-master ranks, workspaces with <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code> do not exist on non-master ranks.
This implies:
- No methods of such a workspace can be called, except when wrapped in an algorithm that has <code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code>.
- Retrieving such a workspace from the AnalysisDataService is not possible.
- Algorithms that transform a workspace into a workspace with <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code> such as <code class="docutils literal notranslate"><span class="pre">DiffractionFocussing2</span></code> should delete the input workspace when using in-place operation.</p>
</section>
<section id="setting-spectrum-numbers">
<h3><a class="toc-backref" href="#id28" role="doc-backlink">Setting spectrum numbers</a><a class="headerlink" href="#setting-spectrum-numbers" title="Permalink to this heading">¶</a></h3>
<p>Setting spectrum numbers via the legacy interface <code class="docutils literal notranslate"><span class="pre">MatrixWorkspace::getSpectrum(size_t)::setSpectrumNo(specnum_t)</span></code> is not supported in MPI runs and will throw an exception.
The reason is that spectrum numbers are used to globally identify a spectrum and thus changing a spectrum number must be done globally, i.e., on all MPI ranks.
Spectrum numbers should be set by using <code class="docutils literal notranslate"><span class="pre">Indexing::IndexInfo</span></code> and <code class="docutils literal notranslate"><span class="pre">MatrixWorkspace::setIndexInfo()</span></code>, or rather by passing the <code class="docutils literal notranslate"><span class="pre">IndexInfo</span></code> to one of the workspace factory functions from <code class="docutils literal notranslate"><span class="pre">DataObjects/WorkspaceCreation.h</span></code>.</p>
</section>
<section id="workspace-indices">
<h3><a class="toc-backref" href="#id29" role="doc-backlink">Workspace indices</a><a class="headerlink" href="#workspace-indices" title="Permalink to this heading">¶</a></h3>
<p>If a workspace is distributed, i.e., has storage mode <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code> workspaces indices lose their meaning.
In particular, <code class="docutils literal notranslate"><span class="pre">MatrixWorkspace::getNumberHistograms()</span></code> will return the local number of spectra and not the global size of the workspace.
For purposes of interaction with the user interface and for internal consistency a global equivalent of the ‘workspace index’ concept has been introduced.
This index is represented by <code class="docutils literal notranslate"><span class="pre">Indexing::GlobalSpectrumIndex</span></code>. <a class="footnote-reference brackets" href="#spectrum-index" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a></p>
<p>The consequences are as follows:</p>
<ul class="simple">
<li><p>Workspace indices should not be logged or written into output of other types such as tables. Instead spectrum numbers (<code class="docutils literal notranslate"><span class="pre">Indexing::SpectrumNumber</span></code>) or global spectrum indices (<code class="docutils literal notranslate"><span class="pre">Indexing::GlobalSpectrumIndex</span></code>) must be used.</p></li>
<li><p>The number of histograms in a workspace obtained from <code class="docutils literal notranslate"><span class="pre">MatrixWorkspace::getNumberHistograms()</span></code> may only be used for processing all spectra, i.e., when each MPI rank is processing all its local spectra.
It should not be logged, written as output, or used for branching execution paths since it is meaningless.
If the total number of spectra in a workspace is required it can be accessed via <code class="docutils literal notranslate"><span class="pre">MatrixWorkspace::indexInfo()::globalSize()</span></code>.</p></li>
<li><p>User input providing indices or spectrum numbers in one way or another must be translated into local indices by <code class="docutils literal notranslate"><span class="pre">IndexInfo</span></code>.
The most common cases are a workspace property that also accepts indices, see <a class="reference internal" href="IndexProperty.html#indexproperty"><span class="std std-ref">IndexProperty</span></a>.</p></li>
<li><p>The distinction between local and global indices must not be exposed to the user.
In particular, the ‘global’ prefix should be omitted, i.e., for the user interface we keep referring to ‘workspace index’, even though it is internally not what used to be the workspace index but rather a global index.
Indices provided by a user may never be interpreted as local indices, since a local index has no fixed meaning.</p></li>
</ul>
</section>
<section id="instrument-and-detectors">
<h3><a class="toc-backref" href="#id30" role="doc-backlink">Instrument and detectors</a><a class="headerlink" href="#instrument-and-detectors" title="Permalink to this heading">¶</a></h3>
<p>As described above, the full set of detectors is held on each MPI rank.
Thus, algorithms that modify detectors must do so <strong>in an identical</strong> manner on all MPI ranks.
That is, if for example detector positions would be modified in an Algorithm it is <strong>not</strong> sufficient to do so for all detectors that have a corresponding spectrum on the MPI rank.
Instead such a modification must be done for all detectors.</p>
<p>The details of this depend on what exactly an algorithm is supposed to do and a generic recipe cannot be given here.
It is however essential to think of this when providing MPI support for an algorithm.</p>
</section>
<section id="gui">
<h3><a class="toc-backref" href="#id31" role="doc-backlink">GUI</a><a class="headerlink" href="#gui" title="Permalink to this heading">¶</a></h3>
<p>Running the Mantid GUI with MPI support, such as a client GUI with a MPI-based backend, is currently not possible.
If it cannot be avoided to add an MPI-related property to an algorithm is shall be made invisible in the GUI.
This can be done by adjusting the property settings when implementing <code class="docutils literal notranslate"><span class="pre">Algorithm::init()</span></code>:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span><span class="w"> </span><span class="cpf">"MantidKernel/InvisibleProperty.h"</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">MyAlg::init</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">// ...</span>
<span class="w"> </span><span class="n">setPropertySettings</span><span class="p">(</span><span class="s">"MyProperty"</span><span class="p">,</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">make_unique</span><span class="o"><</span><span class="n">InvisibleProperty</span><span class="o">></span><span class="p">());</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
<section id="units-tests">
<h3><a class="toc-backref" href="#id32" role="doc-backlink">Units Tests</a><a class="headerlink" href="#units-tests" title="Permalink to this heading">¶</a></h3>
<p>For unit testing the MPI support of an algorithm a fake backend that can be run without MPI is provided.
No modifications to the code under test a required.
In the unit test case <code class="docutils literal notranslate"><span class="pre">ParallelRunner</span></code> from <code class="docutils literal notranslate"><span class="pre">MantidTestHelpers</span></code> is used to run the algorithm (or other code) under test as if it were part of on MPI run.
A typical example could look as follows:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="cp">#include</span><span class="w"> </span><span class="cpf">"MantidFrameworkTestHelpers/ParallelAlgorithmCreation.h"</span>
<span class="linenos"> 2</span><span class="cp">#include</span><span class="w"> </span><span class="cpf">"MantidFrameworkTestHelpers/ParallelRunner.h"</span>
<span class="linenos"> 3</span>
<span class="linenos"> 4</span><span class="k">namespace</span><span class="w"> </span><span class="p">{</span>
<span class="linenos"> 5</span><span class="kt">void</span><span class="w"> </span><span class="nf">run_algorithm</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">Parallel</span><span class="o">::</span><span class="n">Communicator</span><span class="w"> </span><span class="o">&</span><span class="n">comm</span><span class="p">,</span>
<span class="linenos"> 6</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">MyType1</span><span class="w"> </span><span class="o">&</span><span class="n">arbitrary</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">MyType2</span><span class="w"> </span><span class="o">&</span><span class="n">arguments</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="linenos"> 7</span><span class="w"> </span><span class="c1">// Creating the algorithm with this helper function is the recommended way,</span>
<span class="linenos"> 8</span><span class="w"> </span><span class="c1">// otherwise the communicator has to be set by hand and the name of the</span>
<span class="linenos"> 9</span><span class="w"> </span><span class="c1">// output workspace must be set to a different value depending on comm.rank()</span>
<span class="linenos">10</span><span class="w"> </span><span class="c1">// to avoid clashes, since the threading backend in ParallelRunner shares the</span>
<span class="linenos">11</span><span class="w"> </span><span class="c1">// ADS for all 'ranks'.</span>
<span class="linenos">12</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">alg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ParallelTestHelpers</span><span class="o">::</span><span class="n">create</span><span class="o"><</span><span class="n">Mantid</span><span class="o">::</span><span class="n">Algorithms</span><span class="o">::</span><span class="n">MyAlg</span><span class="o">></span><span class="p">(</span><span class="n">comm</span><span class="p">);</span>
<span class="linenos">13</span><span class="w"> </span><span class="n">alg</span><span class="o">-></span><span class="n">setProperty</span><span class="p">(</span><span class="s">"InputWorkspace"</span><span class="p">,</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">make_shared</span><span class="o"><</span><span class="n">WorkspaceTester</span><span class="o">></span><span class="p">());</span>
<span class="linenos">14</span><span class="w"> </span><span class="n">alg</span><span class="o">-></span><span class="n">execute</span><span class="p">();</span>
<span class="linenos">15</span><span class="w"> </span><span class="n">Workspace_const_sptr</span><span class="w"> </span><span class="n">ws</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">alg</span><span class="o">-></span><span class="n">getProperty</span><span class="p">(</span><span class="s">"OutputWorkspace"</span><span class="p">);</span>
<span class="linenos">16</span><span class="w"> </span><span class="n">TS_ASSERT_EQUALS</span><span class="p">(</span><span class="n">ws</span><span class="o">-></span><span class="n">storageMode</span><span class="p">(),</span><span class="w"> </span><span class="n">Parallel</span><span class="o">::</span><span class="n">StorageMode</span><span class="o">::</span><span class="n">Distributed</span><span class="p">);</span>
<span class="linenos">17</span><span class="p">}</span>
<span class="linenos">18</span>
<span class="linenos">19</span><span class="k">class</span><span class="w"> </span><span class="nc">MyAlgTest</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="n">CxxTest</span><span class="o">::</span><span class="n">TestSuite</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">20</span><span class="k">public</span><span class="o">:</span>
<span class="linenos">21</span><span class="w"> </span><span class="c1">// ...</span>
<span class="linenos">22</span>
<span class="linenos">23</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="n">test_parallel</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">24</span><span class="w"> </span><span class="c1">// Runs run_algorithm in multiple threads. The first argument passed to</span>
<span class="linenos">25</span><span class="w"> </span><span class="c1">// run_algorithm is of type Parallel::Communicator and is guaranteed to</span>
<span class="linenos">26</span><span class="w"> </span><span class="c1">// have size() > 1, i.e., more than one rank, in at least one call to</span>
<span class="linenos">27</span><span class="w"> </span><span class="c1">// run_algorithm (it is in addition also called with a single 'rank').</span>
<span class="linenos">28</span><span class="w"> </span><span class="n">ParallelTestHelpers</span><span class="o">::</span><span class="n">runParallel</span><span class="p">(</span><span class="n">run_algorithm</span><span class="p">,</span><span class="w"> </span><span class="mi">42</span><span class="p">,</span><span class="w"> </span><span class="mf">42.0</span><span class="p">);</span>
<span class="linenos">29</span><span class="w"> </span><span class="p">}</span>
<span class="linenos">30</span><span class="p">};</span>
</pre></div>
</div>
<p>Here <code class="docutils literal notranslate"><span class="pre">MantidTestHelpers/ParallelAlgorithmCreation.h</span></code> provides the algorithm factory method <code class="docutils literal notranslate"><span class="pre">ParallelTestHelpers::create<WorkspaceType></span></code>.
<code class="docutils literal notranslate"><span class="pre">MantidTestHelpers/ParallelRunner.h</span></code> provides <code class="docutils literal notranslate"><span class="pre">ParallelTestHelpers::runParallel</span></code>, which uses <code class="docutils literal notranslate"><span class="pre">ParallelRunner</span></code> with a reasonable default choice for the number of ranks.</p>
</section>
<section id="documentation">
<h3><a class="toc-backref" href="#id33" role="doc-backlink">Documentation</a><a class="headerlink" href="#documentation" title="Permalink to this heading">¶</a></h3>
<p>When adding MPI support for an algorithm, add it to the table at the end of this document.
Potential limitations must be described in the comments.</p>
</section>
<section id="porting-python-reduction-scripts-in-practice">
<h3><a class="toc-backref" href="#id34" role="doc-backlink">Porting Python reduction scripts in practice</a><a class="headerlink" href="#porting-python-reduction-scripts-in-practice" title="Permalink to this heading">¶</a></h3>
<p>The mechanism of execution modes and storage modes allows for “guided” porting of algorithms as follows:</p>
<ol class="arabic simple">
<li><p>Run Python script such as a system test with two (or more) MPI ranks.</p></li>
<li><p>At some point an algorithm without any MPI support or inadequate MPI support may be encountered, resulting in an error message similar to this:</p></li>
</ol>
<blockquote>
<div><div class="highlight-none notranslate"><div class="highlight"><pre><span></span>MyAlg-[Error] Error in execution of algorithm MyAlg:
MyAlg-[Error] Algorithm does not support execution with input workspaces of the following storage types:
MyAlg-[Error] InputWorkspace Parallel::StorageMode::Distributed
MyAlg-[Error] InputWorkspaceMonitor Parallel::StorageMode::Cloned
MyAlg-[Error] .
</pre></div>
</div>
</div></blockquote>
<ol class="arabic simple" start="3">
<li><p>Add the required MPI support to <code class="docutils literal notranslate"><span class="pre">MyAlg</span></code> with one of the mechanisms described above. In rare cases the combination of storage modes of the inputs may be unexpected, indicating an error earlier in the chain which needs to be fixed.</p></li>
<li><p>Go to 1., until the script finishes successfully.</p></li>
</ol>
</section>
</section>
<section id="supported-algorithms">
<h2><a class="toc-backref" href="#id35" role="doc-backlink">Supported Algorithms</a><a class="headerlink" href="#supported-algorithms" title="Permalink to this heading">¶</a></h2>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Algorithm</p></th>
<th class="head"><p>Supported modes</p></th>
<th class="head"><p>Comments</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>AlignAndFocusPowder</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>AlignAndFocusPowderFromFiles</p></td>
<td><p>Distributed</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>AlignDetectors</p></td>
<td><p>all</p></td>
<td><p>with <code class="docutils literal notranslate"><span class="pre">StorageMode::Distributed</span></code> this touches only detectors that have spectra on this rank, i.e., the modified instrument is not in an identical state on all ranks</p></td>
</tr>
<tr class="row-odd"><td><p>BinaryOperation</p></td>
<td><p>all</p></td>
<td><p>not supported if <code class="docutils literal notranslate"><span class="pre">AllowDifferentNumberSpectra</span></code> is enabled</p></td>
</tr>
<tr class="row-even"><td><p>CalculateChiSquared</p></td>
<td><p>MasterOnly, Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFittingAlgorithm</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>CalculateCostFunction</p></td>
<td><p>MasterOnly, Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFittingAlgorithm</span></code></p></td>
</tr>
<tr class="row-even"><td><p>CalculateFlatBackground</p></td>
<td><p>MasterOnly, Identical</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>CalculateTransmission</p></td>
<td><p>MasterOnly, Identical</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>CloneWorkspace</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Comment</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>CompareWorkspace</p></td>
<td><p>MasterOnly, Identical</p></td>
<td><p>if one input has <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code> and the other has <code class="docutils literal notranslate"><span class="pre">StorageMode::MasterOnly</span></code> then <code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> is used, with <code class="docutils literal notranslate"><span class="pre">ExecutionMode::MasterOnly</span></code> the workspaces always compare equal on non-master ranks</p></td>
</tr>
<tr class="row-odd"><td><p>CompressEvents</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>ConvertDiffCal</p></td>
<td><p>MasterOnly, Identical</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>ConvertToHistogram</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>ConvertToPointData</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>ConvertUnits</p></td>
<td><p>all</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">AlignBins</span></code> not supported; for indirect energy mode the number of resulting bins is in general inconsistent across MPI ranks</p></td>
</tr>
<tr class="row-even"><td><p>CopyInstrumentParameters</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>CreateSingleValuedWorkspace</p></td>
<td><p>Identical</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">OutputWorkspace</span></code> has <code class="docutils literal notranslate"><span class="pre">StorageMode::Cloned</span></code>, support of <code class="docutils literal notranslate"><span class="pre">MasterOnly</span></code> would require adding property for selecting the mode</p></td>
</tr>
<tr class="row-even"><td><p>CreateWorkspace</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>CropToComponent</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>CropWorkspace</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">ExtractSpectra</span></code> regarding X cropping</p></td>
</tr>
<tr class="row-odd"><td><p>DeleteWorkspace</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>DetermineChunking</p></td>
<td><p>MasterOnly, Identical</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Divide</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">BinaryOperation</span></code></p></td>
</tr>
<tr class="row-even"><td><p>EstimateFitParameters</p></td>
<td><p>MasterOnly, Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFittingAlgorithm</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>EvaluateFunction</p></td>
<td><p>MasterOnly, Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFittingAlgorithm</span></code></p></td>
</tr>
<tr class="row-even"><td><p>ExponentialCorrection</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">UnaryOperation</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>ExtractSingleSpectrum</p></td>
<td><p>all</p></td>
<td><p>in practice <code class="docutils literal notranslate"><span class="pre">ExecutionMode::Distributed</span></code> not supported due to current nonzero-spectrum-count limitation</p></td>
</tr>
<tr class="row-even"><td><p>ExtractSpectra2</p></td>
<td><p>all</p></td>
<td><p>currently not available via algorithm factory or Python</p></td>
</tr>
<tr class="row-odd"><td><p>ExtractSpectra</p></td>
<td><p>all</p></td>
<td><p>not supported with <code class="docutils literal notranslate"><span class="pre">DetectorList</span></code>, cropping in X may exhibit inconsistent behavior in case spectra have common boundaries within some ranks but not within all ranks or across ranks</p></td>
</tr>
<tr class="row-even"><td><p>FFTSmooth2</p></td>
<td><p>MasterOnly, Identical</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>FilterBadPulses</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>FilterByLogValue</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>FilterByTime</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>FilterEventsByLogValuePreNexus</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>FindDetectorsInShape</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>FindPeakBackground</p></td>
<td><p>MasterOnly, Identical</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>FindPeaks</p></td>
<td><p>MasterOnly, Identical</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Fit</p></td>
<td><p>MasterOnly, Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFittingAlgorithm</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>GeneratePythonScript</p></td>
<td><p>MasterOnly</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>GroupWorkspaces</p></td>
<td><p>all</p></td>
<td><p>grouping workspaces with mixed <code class="docutils literal notranslate"><span class="pre">StorageMode</span></code> is not supported</p></td>
</tr>
<tr class="row-odd"><td><p>IFileLoader</p></td>
<td><p>Identical</p></td>
<td><p>implicitly adds support for many load-algorithms inheriting from this</p></td>
</tr>
<tr class="row-even"><td><p>IFittingAlgorithm</p></td>
<td><p>MasterOnly, Identical</p></td>
<td><p>implicitly adds support for several fit-algorithms inheriting from this</p></td>
</tr>
<tr class="row-odd"><td><p>Load</p></td>
<td><p>all</p></td>
<td><p>actual supported mode is dictated by underlying load algorithm, which depends on file type</p></td>
</tr>
<tr class="row-even"><td><p>LoadAscii2</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadAscii</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadBBY</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadCalFile</p></td>
<td><p>Identical</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>LoadCanSAS1D</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadDaveGrp</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadDiffCal</p></td>
<td><p>Identical</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>LoadEmptyInstrument</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadEventAndCompress</p></td>
<td><p>Distributed</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>LoadEventNexus</p></td>
<td><p>Distributed</p></td>
<td><p>storage mode of output cannot be changed via a parameter currently, min and max bin boundary are not globally the same</p></td>
</tr>
<tr class="row-even"><td><p>LoadEventPreNexus2</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadFITS</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadGSS</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadILLDiffraction</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadILLIndirect2</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadILLReflectometry</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadILLSANS</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadILLTOF2</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadInstrument</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>LoadIsawPeaks</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadISISNexus2</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadLLB</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadMask</p></td>
<td><p>Identical</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>LoadMcStas</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadMcStasNexus</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadMD</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadMLZ</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadMuonNexus</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadNexusLogs</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>LoadNexusMonitors2</p></td>
<td><p>Identical</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>LoadNexusProcessed</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadNXcanSAS</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadNXSPE</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadParameterFile</p></td>
<td><p>all</p></td>
<td><p>segfaults when used in unit tests with MPI threading backend due to <a class="reference external" href="https://github.com/mantidproject/mantid/issues/9365">#9365</a>, normal use should be ok</p></td>
</tr>
<tr class="row-even"><td><p>LoadPDFgetNFile</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadPreNexus</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadQKK</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadRawHelper</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadRKH</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadSassena</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadSESANS</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadSINQFocus</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadSNSspec</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadSPE</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadSpice2D</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadSQW2</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadSQW</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadSwans</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>LoadTBL</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>LoadTOFRawNexus</p></td>
<td><p>Identical</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">IFileLoader</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Logarithm</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">UnaryOperation</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>MaskBins</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>MaskDetectorsInShape</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>MaskSpectra</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Minus</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">BinaryOperation</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>MoveInstrumentComponent</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>MultipleScatteringCylinderAbsorption</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Multiply</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">BinaryOperation</span></code></p></td>
</tr>
<tr class="row-even"><td><p>NormaliseByCurrent</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>OneMinusExponentialCor</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">UnaryOperation</span></code></p></td>
</tr>
<tr class="row-even"><td><p>PDDetermineCharacterizations</p></td>
<td><p>all</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>PDLoadCharacterizations</p></td>
<td><p>Identical</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Plus</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">BinaryOperation</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>PoissonErrors</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">BinaryOperation</span></code></p></td>
</tr>
<tr class="row-even"><td><p>PolynomialCorrection</p></td>
<td><p>all</p></td>
<td><p>see <code class="docutils literal notranslate"><span class="pre">UnaryOperation</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Q1D2</p></td>
<td><p>all</p></td>
<td><p>not all optional normalization inputs are supported</p></td>
</tr>