User Advice and Best Practices

Erik A. Roberts edited this page Jun 20, 2018 · 24 revisions

Managing model files

  • We recommend storing copies of all files for a given model in a single directory and executing calls to dsSimulate from that working directory.
    • If the model contains many files and the files are located in a folder hierarchy, use one of the techniques from section 3 of the installation instructions to add your model folder to the matlab path.
  • We also recommend storing commonly used models in the models/personal directory, which is ignored by DynaSim's git metadata.
    • Alternatively, on Linux and Mac OS, one can make a symbolic link using ln -s source target and store the files elsewhere. This is useful if one's models are stored inside of a separate git repository.
  • We strongly recommend managing versions of models using version control software like git with cloud sync to github or gitlab. Separating models into their own repos allows for easy distribution of them.

High Performance Computing Optimization

Recommended cluster parameter values to start with:

  • solver = 'rk2'
  • dt = 0.01 [ms]
  • downsample_factor = 1/dt (note: must define dt first or assume default of 0.01 ms)
  • compile_flag = 1
  • parallel_flag = 1
  • one_solve_file_flag = 1
  • sims_per_job = 10
data=dsSimulate(eqns, 'vary',vary, 'downsample_factor',downsample_factor,...
  'compile_flag',compile_flag, 'solver',solver, 'dt',dt, 'parallel_flag',parallel_flag,...
  'one_solve_file_flag',one_solve_file_flag, 'sims_per_job',sims_per_job);

more option notes:

  • try solver = 'rk4' and/or smaller dt if simulations are unstable (i.e. voltages move to infinity)
  • one can increase dt, i.e. the time step, as long as the solution is stable/converges
  • set compile_flag = 1 to compile m-files to binary for speed
    • compilation is most beneficial when Npop > 1
  • set sims_per_job > 1 to reduce the proportional time spent starting matlab
  • use built-in solver for adaptive time steps
  • make your startup.m file is as minimal as possible to reduce service unit time wasted on matlab startup

For more information, see dsSimulate documentation.

batchdirs folder location

The batchdirs directory needed for temporary files during cluster submissions is stored in the home directory. Home directories may be limited in storage compared to external cluster storage. One solution is to store the batchdirs directory in another location with larger storage allocation, and symbolically link it to ~/batchdirs using a command like: ln -s /the/actual/location/of/batchdirs ~/batchdirs. This enables DynaSim to use ~/batchdirs normally, but have the data stored elsewhere. If doing this, one needs to remove a ~/batchdirs directory first before creating a symbolic link in its place.


  • Naming Convention for Connections: Post_Pre_VariableName
  • Some versions of Hodgkin Huxley equations can divide by 0. This may be remedied by changing from the alpha/beta notation to the inf/tau version or visa versa.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.