Ticket #5710 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

ConvertToMD performance

Reported by: Martyn Gigg Owned by: Alex Buts
Priority: major Milestone: Release 2.3
Component: Mantid Keywords: PatchCandidate,Released
Cc: nick.draper@… Blocked By:
Blocking: Tester: Roman Tolchenov

Description

This relates to #5682 and the comments surrounding the performance of the new ConvertToMD code.

I've attached a script and picture comparing the timings of running ConvertToMDEvents & ConvertToMD on the same input data. In this circumstance the code is faster. Is the performance degradation much more isolated than we think?

Attachments

ConvertToMDSpeed.png (172.6 KB) - added by Martyn Gigg 8 years ago.
convert_to_md_speed.py (604 bytes) - added by Martyn Gigg 8 years ago.

Change History

Changed 8 years ago by Martyn Gigg

Changed 8 years ago by Martyn Gigg

comment:1 Changed 8 years ago by Martyn Gigg

Note: The MERLIN test data file is in the system test repository.

comment:2 Changed 8 years ago by Alex Buts

The code degradation was occurring on large files (the real one) when multiple splitting was happening.

comment:3 Changed 8 years ago by Alex Buts

  • Status changed from new to accepted

comment:4 Changed 8 years ago by Alex Buts

refs #5710 this mainly fixes the issue.

The performance of the new code is not worth and even better (multithreading part) wrt the old code.

Changeset: 71fe48859f0a831713e7c22bf4ceda16ef869cc9

comment:5 Changed 8 years ago by Alex Buts

the script testing performance for different parts of the code is provided

# Note that default conversion to events workspace compresses histogram data to have approximately 10 data-points per event. 
# The resulting MD workspace build from events contains ~40M events wrt the MD workspace build directly from histogram 
# containing ~184M events. The code converting from histogram in this example does much more work. 
#
Load(Filename='D:\Data\eclipse\workspaces\iliad\MER12524.raw',OutputWorkspace='MER12524',LoadMonitors=r'Separate')
SetUB(Workspace='MER12524',a='2.8700000000000001',b='2.8700000000000001',c='2.8700000000000001')
perfomance=1
ConvertToEventWorkspace(InputWorkspace='MER12524',OutputWorkspace='MER12524Ev')
##----------------------------------------------------------------------------------
## Old TMD Code in New Mantid; Adding to MD WS runs single threaded
ConvertToMDEvents(InputWorkspace='MER12524',OutputWorkspace='MER12524MD_old',QDimensions='Q3D',QConversionScales='HKL',dEAnalysisMode='Elastic',MinValues='-50,-50,-50',MaxValues='50,50,50')
#Duration 67 seconds;  In Mantid 2.1 was 77 sec
if perfomance:
	DeleteWorkspace('MER12524MD_old')

ConvertToMDEvents(InputWorkspace='MER12524Ev',OutputWorkspace='MER12524MDEv_old',QDimensions='Q3D',QConversionScales='HKL',dEAnalysisMode='Elastic',MinValues='-50,-50,-50',MaxValues='50,50,50')
# Duration 16 seconds;  In Mantid 2.1 was 16.79 
if perfomance:
	DeleteWorkspace('MER12524MDEv_old')

##----------------------------------------------------------------------------------
## Janik's 3D code
ConvertToDiffractionMDWorkspace(InputWorkspace='MER12524Ev',OutputWorkspace='CNS_MD',OutputDimensions='HKL')
#Duration 17 seconds
if perfomance:
	DeleteWorkspace('CNS_MD')
ConvertToDiffractionMDWorkspace(InputWorkspace='MER12524',OutputWorkspace='CNS_MD_HIST',OutputDimensions='HKL')
# Duration 56.76 seconds
if perfomance:
	DeleteWorkspace('CNS_MD_HIST')
##----------------------------------------------------------------------------------
## New MD code; Adding to MD ws runs multithreaded
ConvertToMD(InputWorkspace='MER12524',OutputWorkspace='MER12524MD_HistNew',QDimensions='Q3D',QConversionScales='HKL',dEAnalysisMode='Elastic',MinValues='-50,-50,-50',MaxValues='50,50,50')
#Duration 49 seconds TMD--  was 76.97 sec
if perfomance:
	DeleteWorkspace('MER12524MD_HistNew')

ConvertToMD(InputWorkspace='MER12524Ev',OutputWorkspace='MER12524MD_EvNew',QDimensions='Q3D',QConversionScales='HKL',dEAnalysisMode='Elastic',MinValues='-50,-50,-50',MaxValues='50,50,50')
# Duration 13 seconds
if perfomance:
	DeleteWorkspace('MER12524MD_EvNew')

comment:6 Changed 8 years ago by Alex Buts

  • Status changed from accepted to verify
  • Resolution set to fixed

comment:7 Changed 8 years ago by Alex Buts

  • Keywords PatchCandidate added

comment:8 Changed 8 years ago by Alex Buts

refs #5710 this mainly fixes the issue.

The performance of the new code is not worth and even better (multithreading part) wrt the old code.

Changeset: 71fe48859f0a831713e7c22bf4ceda16ef869cc9

comment:9 Changed 8 years ago by Roman Tolchenov

  • Status changed from verify to verifying
  • Tester set to Roman Tolchenov

comment:10 Changed 8 years ago by Roman Tolchenov

  • Status changed from verifying to closed

Ran the script. The times of different algorithms looked comparable.

comment:11 Changed 7 years ago by Nick Draper

  • Keywords PatchCandidate,Released added; PatchCandidate removed

comment:12 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6556

Note: See TracTickets for help on using tickets.