Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSagan committed Sep 25, 2023
2 parents 75f99a4 + b09db0c commit f870a7e
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 10 deletions.
6 changes: 4 additions & 2 deletions build_system/Master.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,10 @@ ENDIF ()

string (STRIP "${ACC_LINK_FLAGS}" ACC_LINK_FLAGS)

SET (ACC_INC_DIRS ${ACC_PLOT_INC_DIRS} ${ACC_INC_DIRS} ${MPI_INC_DIRS})
SET (ACC_LIB_DIRS ${ACC_PLOT_LIB_DIRS} ${ACC_LIB_DIRS} ${MPI_LIB_DIRS})
# Environment variables BMAD_USER_INC_DIRS and BMAD_USER_LIB_DIRS hold include/library directories
# to search for include/module or libraries respectively. Multiple directories separated by semicolons.
SET (ACC_INC_DIRS $ENV{BMAD_USER_INC_DIRS} ${ACC_PLOT_INC_DIRS} ${ACC_INC_DIRS} ${MPI_INC_DIRS})
SET (ACC_LIB_DIRS $ENV{BMAD_USER_LIB_DIRS} ${ACC_PLOT_LIB_DIRS} ${ACC_LIB_DIRS} ${MPI_LIB_DIRS})


#--------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions tao/code/tao_de_optimizer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function merit_wrapper (var_vec, status, iter_count) result (merit)

call tao_set_opt_vars (var_vec, s%global%optimizer_var_limit_warn)
merit_end = tao_merit ()
call tao_var_write (s%global%var_out_file)
if (s%global%opti_write_var_file) call tao_var_write (s%global%var_out_file)

write (line, '(a, es14.6)') 'Merit start:', merit_start
call out_io (s_blank$, r_name, line)
Expand Down Expand Up @@ -151,7 +151,7 @@ function merit_wrapper (var_vec, status, iter_count) result (this_merit)

if (this_merit <= 0.98*merit_min_type .or. t_delta > 10) then
write (line, '(a, es14.6)') ' So far the minimum is ', merit_min
call tao_var_write (s%global%var_out_file)
if (s%global%opti_write_var_file) call tao_var_write (s%global%var_out_file)

if (calc_ok) then
call out_io (s_blank$, r_name, stars, line, stars)
Expand Down
2 changes: 1 addition & 1 deletion tao/code/tao_lm_optimizer_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ subroutine tao_lm_optimizer (abort)

if (finished .or. i == s%global%n_opti_cycles+1) then
a_lambda = 0 ! tell mrqmin we are finished
call tao_var_write (s%global%var_out_file)
if (s%global%opti_write_var_file) call tao_var_write (s%global%var_out_file)
endif

call super_mrqmin (y, weight, a, chi_sq, tao_mrq_func, storage, a_lambda, status)
Expand Down
2 changes: 1 addition & 1 deletion tao/code/tao_lmdif_optimizer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ subroutine tao_lmdif_optimizer (abort)
call out_io (s_blank$, r_name, line)
endif

call tao_var_write (s%global%var_out_file)
if (s%global%opti_write_var_file) call tao_var_write (s%global%var_out_file)
deallocate (var_at_min)

end subroutine
Expand Down
2 changes: 2 additions & 0 deletions tao/code/tao_python_cmd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4542,6 +4542,7 @@ subroutine tao_python_cmd (input_str)
nl=incr(nl); write (li(nl), lmt) 'beam_timer_on;LOGIC;T;', s%global%beam_timer_on
nl=incr(nl); write (li(nl), lmt) 'var_limits_on;LOGIC;T;', s%global%var_limits_on
nl=incr(nl); write (li(nl), lmt) 'only_limit_opt_vars;LOGIC;T;', s%global%only_limit_opt_vars
nl=incr(nl); write (li(nl), lmt) 'opti_write_var_file;LOGIC;T;', s%global%opti_write_var_file
nl=incr(nl); write (li(nl), lmt) 'optimizer_var_limit_warn;LOGIC;T;', s%global%optimizer_var_limit_warn
nl=incr(nl); write (li(nl), lmt) 'optimizer_allow_user_abort;LOGIC;T;', s%global%optimizer_allow_user_abort
nl=incr(nl); write (li(nl), lmt) 'rf_on;LOGIC;T;', s%global%rf_on
Expand Down Expand Up @@ -4593,6 +4594,7 @@ subroutine tao_python_cmd (input_str)

nl=incr(nl); write (li(nl), amt) 'optimizer;ENUM;T;', trim(s%global%optimizer)
nl=incr(nl); write (li(nl), amt) 'var_out_file;FILE;T;', trim(s%global%var_out_file)
nl=incr(nl); write (li(nl), lmt) 'opti_write_var_file;LOGIC;T;', s%global%opti_write_var_file

nl=incr(nl); write (li(nl), lmt) 'derivative_recalc;LOGIC;T;', s%global%derivative_recalc
nl=incr(nl); write (li(nl), lmt) 'derivative_uses_design;LOGIC;T;', s%global%derivative_uses_design
Expand Down
2 changes: 2 additions & 0 deletions tao/code/tao_show_this.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2105,6 +2105,7 @@ subroutine tao_show_this (what, result_id, lines, nl)
nl=nl+1; write(lines(nl), lmt) ' %label_keys = ', s%global%label_keys
nl=nl+1; write(lines(nl), lmt) ' %lattice_calc_on = ', s%global%lattice_calc_on
nl=nl+1; write(lines(nl), lmt) ' %only_limit_opt_vars = ', s%global%only_limit_opt_vars
nl=nl+1; write(lines(nl), lmt) ' %opti_write_var_file = ', s%global%opti_write_var_file
nl=nl+1; write(lines(nl), lmt) ' %optimizer_var_limit_warn = ', s%global%optimizer_var_limit_warn
nl=nl+1; write(lines(nl), amt) ' %phase_units = ', angle_units_name(s%global%phase_units)
nl=nl+1; write(lines(nl), lmt) ' %rad_int_calc_on = ', s%global%rad_int_calc_on
Expand Down Expand Up @@ -6403,6 +6404,7 @@ subroutine show_opt ()

nl=nl+1; write(lines(nl), amt) ' %optimizer = ', quote(s%global%optimizer)
nl=nl+1; write(lines(nl), amt) ' %var_out_file = ', quote(s%global%var_out_file)
nl=nl+1; write(lines(nl), lmt) ' %opti_write_var_file = ', s%global%opti_write_var_file

nl=nl+1; write(lines(nl), lmt) ' %derivative_recalc = ', s%global%derivative_recalc
nl=nl+1; write(lines(nl), lmt) ' %derivative_uses_design = ', s%global%derivative_uses_design
Expand Down
1 change: 1 addition & 0 deletions tao/code/tao_struct.f90
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ module tao_struct
logical :: only_limit_opt_vars = .false. ! Only apply limits to variables used in optimization.
logical :: opt_with_ref = .false. ! Use reference data in optimization?
logical :: opt_with_base = .false. ! Use base data in optimization?
logical :: opti_write_var_file = .true. ! "run" command writes var_out_file
logical :: optimizer_allow_user_abort = .true. ! See Tao manual for more details.
logical :: optimizer_var_limit_warn = .true. ! Warn when vars reach a limit with optimization.
logical :: plot_on = .true. ! Do plotting?
Expand Down
7 changes: 6 additions & 1 deletion tao/doc/initialization.tex
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ \subsection{Tao\_global\_struct Structure}
\index{single_mode}\index{lm_opt_deriv_reinit}
\index{label_lattice_elements}\index{label_keys}\index{derivative_recalc}
\index{lattice_calc_on}\index{print_command}\index{default_init_file}\index{derivative_uses_design}
\index{current_init_file}\index{var_out_file}\index{draw_curve_off_scale_warn}
\index{current_init_file}\index{var_out_file}\index{draw_curve_off_scale_warn}\index{opti_write_var_file}
The \vn{tao_global_struct} structure contains \tao global parameters. The components of this structure are:
\begin{example}
type tao_global_struct:
Expand Down Expand Up @@ -629,6 +629,7 @@ \subsection{Tao\_global\_struct Structure}
only_limit_opt_vars = F ! Apply limits only if variable is used in optimization?
opt_with_ref = F ! use reference data in optimization?
opt_with_base = F ! use base data in optimization?
opti_var_write_file = T ! ``run'' command writes var_out_file
optimizer_allow_user_abort = T ! See below.
optimizer_var_limit_warn = T ! Warn when vars reach a limit when optimizing?
plot_on = T ! Do plotting?
Expand Down Expand Up @@ -827,6 +828,10 @@ \subsection{Tao\_global\_struct Structure}
file will be generated for each universe with the universe index substituted for the hash symbol.
For example, with the default file name, the name of the file for universe 1 will be ``\vn{var1.out}''.
If the file name is blank, the results will be printed on the screen and no file will be generated.
%
\item{\vn{global%opti_write_var_file}} \Newline
Normally the optimizer writes to \vn{global%var_out_file}. Setting \vn{global%opti_write_var_file}
to \texttt{F} prevents this.
\end{description}

Random number generation in \tao is divided into two categories: Random numbers used for
Expand Down
3 changes: 2 additions & 1 deletion util/Distribution_User_Utility_Wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ if ( [[ "${CONDA_BUILD}" ]] ) ; then
[ "${ACC_PLOT_PACKAGE}" == "plplot" ] && DIRLIST=( plplot ${DIRLIST[*]} )
else
# List of Project Directories - Order here matters!
DIRLIST=(${ACC_PLOT_PACKAGE_DIR})
DIRLIST=()
[ -d "${ACC_PLOT_PACKAGE_DIR}" ] && DIRLIST=(${ACC_PLOT_PACKAGE_DIR})
for d in hdf5 fftw lapack lapack95 gsl fgsl forest xraylib sim_utils bmad tao cpp_bmad_interface code_examples bsim util_programs lux regression_tests
do
[ -d "$DIST_BASE_DIR/$d" ] && DIRLIST=(${DIRLIST[*]} $d)
Expand Down
2 changes: 1 addition & 1 deletion util/acc_build_common
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ if ( [ "${1}" == "-debug" ] || [ "${1}" == "-production" ] ) ; then
func_set_fortran_flags
[ "${PROJ_DIR_NAME}" == "LAPACK95" ] || func_make_build_directory
func_set_LD_LIBRARY_PATH
func_install_utilities
[ -d ${BASE_DIR}/gnu_utilities_src ] && func_install_utilities

echo -e "\nThe search PATH is: ${PATH}\n"
echo -e "\nThe search LD_LIBRARY_PATH is: ${LD_LIBRARY_PATH}\n"
Expand Down
2 changes: 1 addition & 1 deletion util/dist_source_me
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#-----------------------------------------------------------------
func_is_dir_toplevel () {

DIST_TOPLEVEL_CHECKLIST="bmad build_system util gnu_utilities_src"
DIST_TOPLEVEL_CHECKLIST="bmad build_system util"
TESTDIR=${1}
RETVAL="Y"

Expand Down

0 comments on commit f870a7e

Please sign in to comment.