Saving HDF Simulation Output File Externally

Hello AnyBody Community,

  • AnyBody.8.0.x
  • AMMR4-Beta
  • Plug-in-gait_MultiTrial_StandingRef with flexible thoracic model, incorporating simple muscles+ligaments+non linear disc+soft rhythm for all 3 spine region
  • Driven by mocap data of several dozens of subjects, reflecting ADL movements
  • Batch process with Python/Jupiter Notebook

As described above, I am simulating dozens, if not hundreds, of trials (y number of subjects * z number of ADL trials) and I quickly ran into problem of storage for the HDF output files.

I know that I can use AnyOutputFile for parameters that I am interested in (which I am already using it). I find that having HDF output useful in the event when I need to replay the simulation again to see what exactly is going on on the graphical rendering of the model.

I am also aware of the ANYBODY_PATH_OUTPUT function where we could specify the location for the output to be stored. My question is: could I define the simulation output location to be on my OneDrive where I have ample of storage instead of meagre capacity of my (albeit still a powerful) laptop? I have been told previously, it is not advisable to have the AnyBody codes on cloud storage; but could just the output be stored there? Will it affecting my (occassionally) replay of the simulation if needed?

Thank you.

Kind regards,
Faizal

Hi Faizal

AnyBody will not be able to upload the files directly to OneDrive. So all you could do is write them to disk, which would then synchronize the files for you. But that will still use the diskspace locally while running.

I have sometimes used a workflow system like snakemake

to run my simulations in parallel, when I run thousands of trials which have to run special sequences. I am still running the individual simulations with AnyPyTools, but I but it is snakemake that orchestrates everything and runs stuff in parallel.

That allowed me to add custom python code that handled the output after each run, and code that aggregate all results in the end and create plots etc.

One postprocessing step could for example be uploading results to the cloud and deleting the file afterwards. Getting started with a tool like snakemake is not easy, so only do that if you have plenty of time, and also reach out to me first. I have some example setups that I can share to get you started.

Another option you could try is adding extra operations in AnyBody that runs after the HDF5 file is saved. That operation could upload the file and delete it afterwards. AnyBody has a special class called "AnyOperationShellExec", which can run system commands.

You could for example do something like this to run a custom upload script after saving the file


Main.RunAnalysis.SaveOutput = {

  AnyOperationShellExec UploadResults = {
      FileName = "cmd.exe";
      WorkDir = ANYBODY_PATH_MAINFILEDIR;
      AnyString Cmd = strquote(ANYBODY_PATH_INSTALLDIR +"\Python\Python.exe") + " MyUploadScipt.py";

      #if 1 
      // For debugging problems with the command
      Arguments = "/C "+ Cmd + " || set /p=Command failed: Hit ENTER to continue..";
      Show = On;
      #else
      Arguments = "/C" + Cmd;
      #endif
  
  };
};
1 Like