Skip to Content.
Sympa Menu

opal - AW: [Opal] example of parameter scan in opal

opal AT lists.psi.ch

Subject: The OPAL Discussion Forum

List archive

AW: [Opal] example of parameter scan in opal


Chronological Thread 
  • From: "Frey Matthias (PSI)" <matthias.frey AT psi.ch>
  • To: "piot AT nicadd.niu.edu" <piot AT nicadd.niu.edu>, "Frey Matthias (PSI)" <matthias.frey AT psi.ch>
  • Cc: opal <opal AT lists.psi.ch>
  • Subject: AW: [Opal] example of parameter scan in opal
  • Date: Tue, 21 Apr 2020 14:43:45 +0000
  • Accept-language: de-DE, de-CH, en-US

Dear Philippe,


I set up a small example with 1 objective. It evaluates the rms beam size in x-direction at 0.2 m. The simulation is a single drift and I vary the number of particles.


Best,

Matthias


Von: opal-request AT lists.psi.ch <opal-request AT lists.psi.ch> im Auftrag von Frey Matthias (PSI) <matthias.frey AT psi.ch>
Gesendet: Dienstag, 21. April 2020 16:17:11
An: piot AT nicadd.niu.edu
Cc: opal
Betreff: AW: [Opal] example of parameter scan in opal
 

Dear Philippe,


The sampler file (varyTDCphase.in) is ok. I recently made the *.data file optional, which will be available in the next OPAL release. You can ignore these "warnings". If you not specify some SAMPLE arguments it will use default values. But it doesn't affect your simulation. It specifies 1 objective since the sampler is derived from the optimizer and the optimizer requires at least 1 objective. Hence, we create a dummy objective.

I have more concerns about your comment regarding all *.stat files look the same. Do the input files also look the same?


Best,

Matthias


Von: Philippe Piot <piot AT nicadd.niu.edu>
Gesendet: Dienstag, 21. April 2020 15:51:37
An: Frey Matthias (PSI)
Cc: opal; piot AT nicadd.niu.edu
Betreff: Re: [Opal] example of parameter scan in opal
 
Dear Matthias,

  Thank you very much. Unfortunately, the example is not "standalone" (it requires some cavity fields) so I cannot copy/paste and run it nor could I find a simple example in the regression. I try following your detailed instructions and encounter a few issues:
- I made a file varyTDCphase.in based on the example (this just varies the phase of a deflecting cavity)
- save a varyTDCphase.tmpl in ./template
- when trying to run it first complains it is missing a varyTDCphase.data (I eventually figured out it is a simple file mine just has two lines:
       CORES 16   
       RAM 8 
)
- after that executing opal sampler.in runs but gives some warning (see below)

  It creates the output file but an inspection of all the .stat file in the 0, 1, 2, ...10 subdirectories are identical. However, the first output of the command line (see below) claims I have 1 objective (while  I do not set any objective).
  I have attached my two files in case somebody finds a smoking gun.

  Thank you,  -- Philippe.



----------------------------------------------------------------

OPAL{0}> opal varyTDCphase.in --inputfile=varyTDCphase.tmpl --outfile=phiscan --outdir=phiscan --num-masters=1 --num-coworkers=2 --restartstep=-2147483648 --jsonDumpFreq=10 --nsamples=11 --simtmpdir=./opal/phiscan --templates=./opal/template
  ✔ 1 objectives
  ✔ 1 dvars

  0 (PID: 9205) ▶ Pilot
  7 (PID: 9212) ▶ Worker
  1 (PID: 9206) ▶ Sampler
  2 (PID: 9207) ▶ Worker
  3 (PID: 9208) ▶ Worker
  4 (PID: 9209) ▶ Worker
  5 (PID: 9210) ▶ Worker
  6 (PID: 9211) ▶ Worker
Warning: argument "one-pilot-converge" not found! Using default value (0).
Warning: argument "restartfile" not found! Using default value ().
Warning: argument "restartfile" not found! Using default value ().
Ippl> CommMPI: Parent process waiting for children ...
Ippl> CommMPI: Child 1 ready.
Ippl> CommMPI: Initialization complete.
Ippl> CommMPI: Started job 1 on host `paris.nicadd.niu.edu'.
Warning: argument "restartfile" not found! Using default value ().
Warning: argument "restartfile" not found! Using default value ().
Ippl> CommMPI: Parent process waiting for children ...
Ippl> CommMPI: Child 1 ready.
Ippl> CommMPI: Initialization complete.
Ippl> CommMPI: Started job 1 on host `paris.nicadd.niu.edu'.
Warning: argument "restartfile" not found! Using default value ().
Warning: argument "restartfile" not found! Using default value ().
Ippl> CommMPI: Started job 1 on host `paris.nicadd.niu.edu'.
Ippl> CommMPI: Parent process waiting for children ...
Ippl> CommMPI: Child 1 ready.
Ippl> CommMPI: Initialization complete.
Can't remove file in directory '/home/piot/JLab_NP_magnetized/straight_merger/opal/phiscan/0', (boost::filesystem::remove: Directory not empty: "/home/piot/JLab_NP_magnetized/straight_merger/opal/phiscan/0/data")
Ippl{0}> CommMPI: Parent process waiting for children ...
Ippl{0}> CommMPI: Child 1 ready.
Philippe Piot,
https://www.niu.edu/advanced-accelerator-randd/
Northern Illinois University, Dept of Physics and
Northern Illinois Center for Accelerator & Detector Development
DeKalb, IL 60115, USA
Tel: 815 753 6473, Web:  http://www.physics.niu.edu/physics/

Argonne National Laboratory, Advanced Photon Source
Accelerator System Division
Lemont, IL 60439, USA
Tel: 630 252 2415, Web:  https://www.aps.anl.gov/Accelerator-Systems-Division 


On Tue, Apr 21, 2020 at 6:52 AM Frey Matthias (PSI) <matthias.frey AT psi.ch> wrote:

Dear Philippe,


there's an example of the sampler in the manual


http://amas.web.psi.ch/opal/Documentation/master/OPAL_Manual.html#_example_input_file_2


In order to do scans, it's best you set RASTER=TRUE in the SAMPLE command, especially if you want to do multi-dimensional scans. Fuhrtermore, make sure you do not have any RANDOM=TRUE in the

individual SAMPLING commands. The sampler has the possibility to evaluate objectives like the optimizer.


http://amas.web.psi.ch/opal/Documentation/master/OPAL_Manual.html#sec.optimiser.opt-pilot-commands


The sampler then writes the objective output to the JSON file.

I've never used this option, hence, I do not have an example at hand. But maybe somebody else has one.


When you defined the objectives (i.e. obj1, obj2, ...), you have to put them into a list OBJECTIVES = {obj1, obj2, ...} in the SAMPLE command.


I hope this helps.


Best,

Matthias



Von: opal-request AT lists.psi.ch <opal-request AT lists.psi.ch> im Auftrag von Philippe Piot <piot AT nicadd.niu.edu>
Gesendet: Dienstag, 21. April 2020 13:32:57
An: opal
Betreff: [Opal] example of parameter scan in opal
 
Dear All,
  Does somebody could share an example of an opal input file demonstrating how to scan a parameter (e.g. a solenoid B field) and record some of the beam parameters at the end of the beamline. Right now I am doing this externally (with my own scripts) but I am wondering if this is possible with the sampler feature. Thank you,  -- Philippe.

Philippe Piot,
https://www.niu.edu/advanced-accelerator-randd/
Northern Illinois University, Dept of Physics and
Northern Illinois Center for Accelerator & Detector Development
DeKalb, IL 60115, USA
Tel: 815 753 6473, Web:  http://www.physics.niu.edu/physics/

Argonne National Laboratory, Advanced Photon Source
Accelerator System Division
Lemont, IL 60439, USA
Tel: 630 252 2415, Web:  https://www.aps.anl.gov/Accelerator-Systems-Division 

Attachment: sampler-example.tar.gz
Description: sampler-example.tar.gz




Archive powered by MHonArc 2.6.19.

Top of Page