tracking get slower when using multiple watch

Moderators: cyao, michael_borland

Post Reply
lyyang
Posts: 7
Joined: 09 Dec 2009, 17:51

tracking get slower when using multiple watch

Post by lyyang » 15 Dec 2009, 17:57

Hi All,

When I use 2-3 watch to record the beam position, I found the tracking is significantly slower, the data is only for 200 turns, should not be a problem, I have set output_at_each_step=0.
Is there any other options to control this I may not set it right ?

Does anyone have similar experience ? Thanks.

My ele looks like this:

&run_setup
lattice = "mv15-MB.lte",
use_beamline = RING,
magnets = %s.mag,
p_central_mev = 3000.0,
default_order = 3,
random_number_seed = 9784782334,
final = "%s.fin",
parameters = "%s.par",
&end

&run_control
n_steps = 1,
n_indices=0,
n_passes = 200
&end

&twiss_output
filename = "%s.twi",
statistics=1,
output_at_each_step=0,
radiation_integrals=1,
&end

&alter_elements
name=MA1, item=DP, value=-0.025,name=MA1,item=DX,value=-0.015
&end

!! DWKMM: MAXAMP, X_MAX=0.03, Y_MAX=0.005
&alter_elements
name=DWKMM, item=X_MAX,value=0.03,
name=DWKMM, item=Y_MAX,value=0.05
&end

!&bunched_beam
!! centroid[6]={0.020, 0, 0.01, 0.001, 0.0, 0}
!&end
!&track &end

&find_aperture
output = "%s.aper",
mode = "n-lines",
xmin = -0.04,
xmax = 0.04,
ymin = .0,
ymax = 0.01,
nx = 21,
ny = 11,
n_splits = 9,
split_fraction = 0.2,
n_lines = 5,
verbosity = 1,
&end

!&bunched_beam &end
!&track &end
!
!&run_setup
! lattice = "mv15-MB2.lte",
! lattice = "fodo.lte",
! use_beamline = RING,
! magnets = %s.mag,
! p_central_mev = 3000.0,
! default_order = 3,
! random_number_seed = 9784782334,
! final = "%s.fin",
! parameters = "%s.par",
!&end
!
!&run_control
! n_steps = 1,
! n_passes = 5000,
!&end
!
!&momentum_aperture
! output = "%s.mmap",
! x_initial = 0.0,
! y_initial = 0.0,
! delta_negative_limit = -0.1,
! delta_positive_limit = 0.1,
! delta_step_size = 0.005,
! steps_back = 2,
! split_step_divisor = 10,
! splits = 3,
! verbosity = 2,
! s_start = 0,
! s_end = 1,
! include_name_pattern="MA1"
!&end


!
!&run_setup
! lattice = "mv15-MB2.lte",
! lattice = "fodo.lte",
! use_beamline = RING,
! magnets = %s.mag,
! p_central_mev = 3000.0,
! default_order = 3,
! random_number_seed = 9784782334,
! final = "%s.fin",
! parameters = "%s.par",
!&end
!
!&run_control
! n_steps = 1,
! n_passes = 5000,
!&end
!
!&momentum_aperture
! output = "%s.mmap",
! x_initial = 0.0,
! y_initial = 0.0,
! delta_negative_limit = -0.1,
! delta_positive_limit = 0.1,
! delta_step_size = 0.005,
! steps_back = 2,
! split_step_divisor = 10,
! splits = 3,
! verbosity = 2,
! s_start = 0,
! s_end = 1,
! include_name_pattern="MA1"
!&end



Lingyun

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: tracking get slower when using multiple watch

Post by michael_borland » 15 Dec 2009, 18:44

Lingyun,

I'm not sure what you are trying to do with this run. Having a DA-search with an initial misalignment and watch points together seems a little confusing. I'd suggest that you just do regular tracking, perhaps with a "dynamic-aperture" beam type generated by bunched_beam.

This could be slow because for each tracked particle it is going to write to the watch file. It involves a lot of disk operations. To make it as fast as possible, be sure FLUSH_INTERVAL=0 and MODE="centroid". Also, if you can work on the local hard disk instead of a disk on a file server, that will help.

Finally, turn off file synchronizaton with this command (should be the first command in the file):
&global_settings
inhibit_fsync = 1
&end

--Michael

lyyang
Posts: 7
Joined: 09 Dec 2009, 17:51

Re: tracking get slower when using multiple watch

Post by lyyang » 15 Dec 2009, 19:37

Sorry, I forgot to comment out the junk pieces.

Thanks Michael:

The inhibit_fsync=1 does help!


lyyang@lyyang-desktop:~/devel$ time elegant track.ele > /dev/null

real 0m2.749s
user 0m2.730s
sys 0m0.010s
lyyang@lyyang-desktop:~/devel$ time elegant track.ele > /dev/null

real 0m59.292s
user 0m2.990s
sys 0m0.030s

60 seconds vs. 3 seconds for 200 turns tracking. It improved a lot!


Here is the track.ele
&run_setup
lattice = "mv15-MB.lte",
use_beamline = RING,
magnets = %s.mag,
p_central_mev = 3000.0,
default_order = 3,
random_number_seed = 9784782334,
final = "%s.fin",
parameters = "%s.par",
&end

&run_control
n_steps = 1,
n_indices=0,
n_passes = 200
&end

&twiss_output
filename = "%s.twi",
statistics=1,
output_at_each_step=0,
radiation_integrals=1,
&end

&bunched_beam
!! centroid[6]={0.020, 0, 0.01, 0.001, 0.0, 0}
&end
&track &end

!
!&find_aperture
! output = "%s.aper",
! mode = "n-lines",
! xmin = -0.04,
! xmax = 0.04,
! ymin = .0,
! ymax = 0.01,
! nx = 21,
! ny = 11,
! n_splits = 9,
! split_fraction = 0.2,
! n_lines = 5,
! verbosity = 1,
!&end
I didn't use NFS, all operations are on local machine.

Lingyun

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: tracking get slower when using multiple watch

Post by michael_borland » 15 Dec 2009, 22:01

Lingyun,

I think this is a result of doing single-particle tracking, which results in very frequent file writing (since the tracking itself is fast). In cases with lots of particles, you'll want to leave file synchronization enabled so that the files update when data is written. Otherwise, you might have to wait a long time to see any data as the program runs.

Probably we should make this automatic...

--Michael

lyyang
Posts: 7
Joined: 09 Dec 2009, 17:51

Re: tracking get slower when using multiple watch

Post by lyyang » 15 Dec 2009, 22:40

Michael,

I woulkd like this to be automatic, since it is a common job people tracking 200 turns, with 2-3 watching elements. 60sec verses 3 sec is too long for a impatient person like me.
But not so ctirical, since the recipe you gave works very well.

Lingyun

Post Reply