NEURON
bbsavestate.h File Reference

Go to the source code of this file.

Classes

class  BBSS_IO
 
class  BBSaveState
 

Functions

void * bbss_buffer_counts (int *len, int **gids, int **sizes, int *global_size)
 BBSaveState API See save_test_bin and restore_test_bin for an example of the use of this following interface. More...
 
void bbss_save_global (void *bbss, char *buffer, int sz)
 Call only on host 0 with a buffer of size equal to the global_size returned from the bbss_buffer_counts call on host 0 sz is the size of the buffer (for error checking only, buffer+sz is out of bounds) More...
 
void bbss_restore_global (void *bbss, char *buffer, int sz)
 Call on all hosts with the buffer contents returned from the call to bbss_save_global. More...
 
void bbss_save (void *bbss, int gid, char *buffer, int sz)
 Call this for each item of the gids from bbss_buffer_counts along with a buffer of size from the corresponding sizes array. More...
 
void bbss_restore (void *bbss, int gid, int npiece, char *buffer, int sz)
 Call this for each item of the gids from bbss_buffer_counts, the number of buffers that were concatenated for the gid, and the concatenated buffer (the concatenated buffer does NOT contain npiece as the first value in the char* buffer pointer). More...
 
void bbss_save_done (void *bbss)
 At the end of the save process, call this to cleanup. More...
 
void bbss_restore_done (void *bbss)
 At the end of the restore process, call this to do some extra setting up and cleanup. More...
 

Function Documentation

◆ bbss_buffer_counts()

void* bbss_buffer_counts ( int *  len,
int **  gids,
int **  sizes,
int *  global_size 
)

BBSaveState API See save_test_bin and restore_test_bin for an example of the use of this following interface.

Note in particular the use in restore_test_bin of a prior clear_event_queue() in order to allow bbss_buffer_counts to pass an assert during the restore process. First call to return the information needed to make the other calls. Returns a pointer used by the other methods. Caller is reponsible for freeing (using free() and not delete []) the returned gids and sizes arrays when finished. The sizes array and global_size are needed for the caller to construct proper buffer sizes to pass to bbss_save_global and bbss_save for filling in. The size of these arrays is returned in *len. They are not needed for restoring (since the caller is passing already filled in buffers that are read by bbss_restore_global and bbss_restore. The gids returned are base gids. It is the callers responsibility to somehow concatenate buffers with the same gid (from different hosts) either after save or before restore and preserve the piece count of the number of concatenated buffers for each base gid. Global_size will only be non_zero for host 0.

Definition at line 773 of file bbsavestate.cpp.

◆ bbss_restore()

void bbss_restore ( void *  bbss,
int  gid,
int  npiece,
char *  buffer,
int  sz 
)

Call this for each item of the gids from bbss_buffer_counts, the number of buffers that were concatenated for the gid, and the concatenated buffer (the concatenated buffer does NOT contain npiece as the first value in the char* buffer pointer).

sz is the size of the buffer (error checking only).

Definition at line 807 of file bbsavestate.cpp.

◆ bbss_restore_done()

void bbss_restore_done ( void *  bbss)

At the end of the restore process, call this to do some extra setting up and cleanup.

When this call returns, bbss will be invalid.

Definition at line 856 of file bbsavestate.cpp.

◆ bbss_restore_global()

void bbss_restore_global ( void *  bbss,
char *  buffer,
int  sz 
)

Call on all hosts with the buffer contents returned from the call to bbss_save_global.

This must be called prior to any calls to bbss_restore sz is the size of the buffer (error checking only). This also does some other important restore initializations.

Definition at line 791 of file bbsavestate.cpp.

◆ bbss_save()

void bbss_save ( void *  bbss,
int  gid,
char *  buffer,
int  sz 
)

Call this for each item of the gids from bbss_buffer_counts along with a buffer of size from the corresponding sizes array.

The buffer will be filled in with savestate information. The gid may be the same on different hosts, in which case it is the callers responsibility to concatentate buffers at some point to allow calling of bbss_restore. sz is the size of the buffer (error checking only).

Definition at line 799 of file bbsavestate.cpp.

◆ bbss_save_done()

void bbss_save_done ( void *  bbss)

At the end of the save process, call this to cleanup.

When this call returns, bbss will be invalid.

Definition at line 818 of file bbsavestate.cpp.

◆ bbss_save_global()

void bbss_save_global ( void *  bbss,
char *  buffer,
int  sz 
)

Call only on host 0 with a buffer of size equal to the global_size returned from the bbss_buffer_counts call on host 0 sz is the size of the buffer (for error checking only, buffer+sz is out of bounds)

Definition at line 785 of file bbsavestate.cpp.