Skip to content

Comparison of GSAS II and MILK Call Overhead

Daniel Savage edited this page Jun 16, 2023 · 15 revisions

TLDR: GSAS-II is currently faster than MILK/MAUD for single histogram XRD Rietveld refinements. This statement neglects any convergence rate differences or advantages that come from e.g. using different texture models available in MAUD.

Refinement setup

The same number of phases, background parameters, same texture model, etc... are used in both GSAS-II and MAUD. Both refinements start from a converged analysis which had perturbed broadening parameters. Results are from a M1 Max MacBook Pro

Example dataset

To retrieve the example dataset and python scripts call milk-examples -e 8

GUI results

MAUD (version 2.995) took 0.35 seconds to do 5 iterations and GSAS-II (version 5394) took 0.27 seconds to do 5 iterations. Very similar.

GSAS-II timing python

from time import time
NTEST=10

#Test
t0 = time()
from GSASIIscriptable import G2Project
t1 = time()
for _ in range(0,NTEST):
    gpx = G2Project(gpxfile='test.gpx')
    gpx.save('test_out.gpx')
    gpx.set_Controls('cycles',5)
    gpx.refine()
t2 = time()

#Results
print(f"GSASIIscriptable import overhead: {t1-t0} seconds")
print(f"run time: {(t2-t1)/NTEST} seconds")
print(f"total time: {(t2-t1)/NTEST+t1-t0} seconds/call")

Output

GSASIIscriptable import overhead: 1.0233948230743408 seconds
run time: 0.31909081935882566 seconds
total time: 1.3424856662750244 seconds/call

MAUD timing python

MAUDBatch MAUDText.ins

loop_
_riet_analysis_file
_riet_analysis_fileToSave
_riet_analysis_iteration_number

 '/pathto/test.par' 'test_out.par' 5
from pathlib import Path
from time import time
NTEST=10

#Test
t0 = time()
from MILK.MAUDText.callMaudText import run_MAUD
t1 = time()
for _ in range(0,NTEST):
    run_MAUD('/Users/dansavage/Documents/Maud.app',"mx8G",timeout=None, simple_call=True,ins_paths=str(Path().cwd() / "MAUDText.ins"))
t2 = time()

#Results
print(f"MILK import overhead: {t1-t0} seconds")
print(f"run time: {(t2-t1)/NTEST} seconds")
print(f"total time: {(t2-t1)/NTEST+t1-t0} seconds/call")

Output

MILK import overhead: 0.421572208404541 seconds
run time: 1.1945274114608764 seconds
total time: 1.6160995960235596 seconds/call

Summary

GSAS-II has a one time module import overhead that once performed, allows refinements to happen at approximately the same speed as in the GUI. MILK has a one time module import overhead as well; however, it also has the additional overhead of starting a Java instance for every refinement. That overhead is a ~240% increase in run time compared to the GUI for this typical single histogram XRD refinement. In the case of a HIPPO texture refinement, the Java overhead is negligible compared to the refinement time.

Clone this wiki locally