Difference between revisions of "Standalone"

From Dynamo
Jump to navigation Jump to search
 
(24 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
To use ''Dynamo'' is standalone modus in a shell, you need to activate first that shell, typically with:
 
To use ''Dynamo'' is standalone modus in a shell, you need to activate first that shell, typically with:
  
<tt>source <DYNAMO_ROOT>/dynamo_activate_linux_shippedMRC.sh</tt>
+
<tt>source <DYNAMO_ROOT>/dynamo_activate_linux_shippedMCR.sh</tt>
  
 
==Using the standalone==
 
==Using the standalone==
Line 15: Line 15:
  
 
=== On the Console shell===
 
=== On the Console shell===
 +
A console shell can be launched through typing <tt>dynamo</tt> or <tt>dynamo x</tt>.
  
 
*Using the Wizard  GUI
 
*Using the Wizard  GUI
Line 34: Line 35:
 
depending on your system configuration. You might also need to adjust permissions through:  
 
depending on your system configuration. You might also need to adjust permissions through:  
  
{{t|chmod u=rxw ./myProject.exe}}
+
<tt>chmod u=rxw ./myProject.exe</tt>
  
 
Note, anyway, that you can run in the Linux shell any project that has been unfolded as standalone: you can thus create your projects in a Matlab shell, check and unfold them under Matlab, an then run them inside a Linux shell using the generated execution script.
 
Note, anyway, that you can run in the Linux shell any project that has been unfolded as standalone: you can thus create your projects in a Matlab shell, check and unfold them under Matlab, an then run them inside a Linux shell using the generated execution script.
  
 
[[File:Computing_environment_gui_standalone.png|thumb|center|400px|Computing environment GUI with the standalone option]]
 
[[File:Computing_environment_gui_standalone.png|thumb|center|400px|Computing environment GUI with the standalone option]]
 +
 +
===For independent commands===
 +
You can use the standalone version to execute independent ''Dynamo'' commands from the linux shell (avoiding the ''Dynamo'' [[console]]). Use the sign <tt>"</tt> to encase the literal  expression that you would write on a Matlab shell. Importantly do NOT use the short version of the commands, i.e., do not use {{t|dwrite}} instead of {{t|dynamo_write}}. For example, writing in your (''Dynamo''-activated) shell:
 +
 +
<tt> dynamo "x=rand(64,64,64);dynamo_write(x,'test.em');" </tt>
 +
 +
will create a cube containing random uniform noise in the temporary workspace and then write it into a file {{t|test.em}}. Note that the workspace is local to each call to ''Dynamo'' through the {{t|dynamo}} command, so that you can NOT divide the order in two:
 +
 +
<tt> dynamo "x=rand(64,64,64);"</tt>
 +
 +
<tt> dynamo "dynamo_write(x,'test.em');" </tt>
 +
 +
would throw an error on the second line.
 +
 +
In general, calling the command {{t|dynamo}} will require an initiation time of several seconds, so it is convenient to pile as many operations as possible inside a single call. Loops are allowed:
 +
 +
<tt>dynamo "for i=1:10;x=rand(64,64,64);dynamo_write(x,sprintf('test%d.em',i));end"</tt>
 +
 +
As an alternative, you can write Dynamo instructions in a text file and pass the name of the file to the {{t|dynamo}} command. For intance, if you have a text file called {{t|commnads.sh}} with this content:
 +
 +
<tt> x=rand(64,64,64);</tt>
 +
<tt> dynamo_write(x,'test.em');</tt>
 +
 +
you can execute the script by writing:
 +
 +
<tt>dynamo commands.sh</tt>
 +
 +
Note that this imposes a maximum of 1024 characters for the full script.
 +
 +
With this technique, it is possible to [[ Scripted creation of a project in the Linux command line| fully design and run a project from the command line  ]], or to integrate ''Dynamo'' operations in third party pipelines.
  
 
==Advantages over the Matlab version==
 
==Advantages over the Matlab version==
Line 46: Line 77:
 
Additionally, the standalone version is automatically delivered with the newest Matlab version. If you are running ''Dynamo'' on Matlab versions previous to release R2014b, you can experiment visualization problems in some programs.
 
Additionally, the standalone version is automatically delivered with the newest Matlab version. If you are running ''Dynamo'' on Matlab versions previous to release R2014b, you can experiment visualization problems in some programs.
  
==Functionality restrictions==
+
== Testing your standalone ==
There is one single functionality not available in the standalone version: although multicore projects can be run normally, the averaging step of each iteration will run on single core. For most projects, this limitation has no practical effect, as the numerical bottleneck is the alignment step.
+
 
 +
You can quickly run a test project in order to check that your standalone is correctly installed:
 +
# Open a system shell. Let's call it ''dynamo console shell''
 +
# Activate Dynamo on this shell: <br /> <tt>source <Dynamo Root>/dynamo_activate_linux_with_shippedMRC.sh</tt> <br/>or equivalently for your system (Mac or Windows).
 +
#Start the ''Dynamo'' console  on it by typing <br /> <tt> dynamo </tt> <br /> on it. Now this shell will work as a console when you can type ''Dynamo'' commands after the prompt <tt>Dynamo >> </tt>
 +
#Under the <tt>Dynamo >></tt> prompt, we will create a tutorial project; <br /> <tt> dtutorial mytest -p ptest</tt><br />
 +
#Open a '''different''' system shell. Let's call it ''project execution shell''.
 +
#On this shell, ''activate'' ''Dynamo'':  <br /><tt>source <Dynamo Root>/dynamo_activate_linux_with_shippedMRC.sh</tt><br />
 +
#Go to same folder in which you created the project. Both shells should have the same <tt>pwd</tt>
 +
#Execute the project in the  ''project execution shell'': <br /><tt>./ptest.exe </tt><br />Please note that this project has been unfolded during creation. For your own projects, you'll need to unfold them manually through the [[dcp GUI]] or with the command: <br /><tt>dvunfold ptest</tt><br /> invoked inside the ''Dynamo console''
 +
# Check the result in the ''dynamo console shell'' by <br /><tt>ddb ptest:a -v </tt><br /> This should show a reconstructed thermosome.
 +
 
 +
== Typical problems with the standalone ==
 +
 
 +
Some of the software installed in your system may enter in conflict with the [[MCR libraries]] supplied by ''Dynamo''. Is it also possible that some system libraries enter in conflict with the [[MCR libraries]]. In most cases, [[Library conflicts | preloading a valid library]] solves the problem.

Latest revision as of 14:56, 4 May 2018


The Dynamo standalone is the version of Dynamo that runs without any Matlab installation. A standalone package carries its own "Matlab" version in the form of MCR libraries.

Activating the standalone

To use Dynamo is standalone modus in a shell, you need to activate first that shell, typically with:

source <DYNAMO_ROOT>/dynamo_activate_linux_shippedMCR.sh

Using the standalone

Our advice to work with the Dynamo standalone is to use at least two linux shells. You would use one shell (let's call it console shell) to run an interactive Dynamo console, where you can create projects, view tomograms or analyse results. In a second linux shell (let's call it computing shell), you can launch the projects edited on the first shell.

Dynamo must be active in both shells!

On the Console shell

A console shell can be launched through typing dynamo or dynamo x.

  • Using the Wizard GUI
    Make certain that when you create a project, you use the standalone option in the Computing environment GUI. Each "core" will be handled by a different openMP process. You can also run alignment projects in the GPU, in which case you also have to mark the set of GPU identifiers.
  • Using the command line
    In case that you are designing your project from the command line, the parameter that controls the environment is called destination. To use the standalone, it should be tuned to system_omp for multicore projects, or to system_gpu for GPU projects.

In both cases you can check and unfold the project in the GUI handled by the Dynamo console to produce an execution script. A project called myProject will generate an standalone script called myProject.exe. Instead of running the project in the Console shell, the Console will be blocked until the project is finished (and wont show any results on screen).

On the computation shell

To execute a project myProject in a shell, you don't need to open any Dynamo console first. Just type:

myProject.exe

or

./myProject.exe

depending on your system configuration. You might also need to adjust permissions through:

chmod u=rxw ./myProject.exe

Note, anyway, that you can run in the Linux shell any project that has been unfolded as standalone: you can thus create your projects in a Matlab shell, check and unfold them under Matlab, an then run them inside a Linux shell using the generated execution script.

Computing environment GUI with the standalone option

For independent commands

You can use the standalone version to execute independent Dynamo commands from the linux shell (avoiding the Dynamo console). Use the sign " to encase the literal expression that you would write on a Matlab shell. Importantly do NOT use the short version of the commands, i.e., do not use dwrite instead of dynamo_write. For example, writing in your (Dynamo-activated) shell:

dynamo "x=rand(64,64,64);dynamo_write(x,'test.em');"

will create a cube containing random uniform noise in the temporary workspace and then write it into a file test.em. Note that the workspace is local to each call to Dynamo through the dynamo command, so that you can NOT divide the order in two:

dynamo "x=rand(64,64,64);"

dynamo "dynamo_write(x,'test.em');"

would throw an error on the second line.

In general, calling the command dynamo will require an initiation time of several seconds, so it is convenient to pile as many operations as possible inside a single call. Loops are allowed:

dynamo "for i=1:10;x=rand(64,64,64);dynamo_write(x,sprintf('test%d.em',i));end"

As an alternative, you can write Dynamo instructions in a text file and pass the name of the file to the dynamo command. For intance, if you have a text file called commnads.sh with this content:

 x=rand(64,64,64); 
 dynamo_write(x,'test.em');

you can execute the script by writing:

dynamo commands.sh

Note that this imposes a maximum of 1024 characters for the full script.

With this technique, it is possible to fully design and run a project from the command line , or to integrate Dynamo operations in third party pipelines.

Advantages over the Matlab version

Besides the obvious advantage of not requiring the purchase of any Matlab license, there are some minor functionalities in Dynamo that would require an extra Toolbox on top of the basic Matlab license, as Statistics or Curve fitting. These functionalities are never used in the basic pipeline of Dynamo, but are part of the extended tools offered by Dynamo through its command line. When you use the standalone, all mathematical toolboxes are automatically available.

Additionally, the standalone version is automatically delivered with the newest Matlab version. If you are running Dynamo on Matlab versions previous to release R2014b, you can experiment visualization problems in some programs.

Testing your standalone

You can quickly run a test project in order to check that your standalone is correctly installed:

  1. Open a system shell. Let's call it dynamo console shell
  2. Activate Dynamo on this shell:
    source <Dynamo Root>/dynamo_activate_linux_with_shippedMRC.sh
    or equivalently for your system (Mac or Windows).
  3. Start the Dynamo console on it by typing
    dynamo
    on it. Now this shell will work as a console when you can type Dynamo commands after the prompt Dynamo >>
  4. Under the Dynamo >> prompt, we will create a tutorial project;
    dtutorial mytest -p ptest
  5. Open a different system shell. Let's call it project execution shell.
  6. On this shell, activate Dynamo:
    source <Dynamo Root>/dynamo_activate_linux_with_shippedMRC.sh
  7. Go to same folder in which you created the project. Both shells should have the same pwd
  8. Execute the project in the project execution shell:
    ./ptest.exe
    Please note that this project has been unfolded during creation. For your own projects, you'll need to unfold them manually through the dcp GUI or with the command:
    dvunfold ptest
    invoked inside the Dynamo console
  9. Check the result in the dynamo console shell by
    ddb ptest:a -v
    This should show a reconstructed thermosome.

Typical problems with the standalone

Some of the software installed in your system may enter in conflict with the MCR libraries supplied by Dynamo. Is it also possible that some system libraries enter in conflict with the MCR libraries. In most cases, preloading a valid library solves the problem.