Re: Checkpoint program at any time ?

From: Paul H. Hargrove (hargrove_at_hpcrd_dot_lbl_dot_gov)
Date: Mon Dec 17 2007 - 11:16:33 PST

  • Next message: Paul H. Hargrove: "BLCR 0.6.2 beta1 now available"
    My mailer appears to have removed the indentation from my code examples.
    Below is another try at sending my second example (I hope the
    indentation survives this time).
    
    -Paul
    
    cr_client_id_t cr;
    cr_checkpoint_args_t cr_args;
    cr_checkpoint_handle_t cr_handle;
    int err;
    ...
    cr = cr_init();
    cr_initialize_checkpoint_args_t(&cr_args); // start with defaults
    cr_args.cr_scope = CR_SCOPE_PROC; // checkpoint a process
    cr_args.cr_target = 0; // process = self
    ...
    //place1:
    cr_args.cr_fd = open(some_filename, O_WRONLY|O_CREAT|O_LARGEFILE, 0400);
    if (cr_args.cr_fd < 0) { // HANDLE ERROR HERE }
    err = cr_request_checkpoint(&cr_args, &cr_handle);
    if (err < 0) { // HANDLE ERROR HERE }
    do { // Wait for checkpoint to complete
      err = cr_poll_checkpoint(&cr_handle, NULL);
      if (err < 0) {
        if (errno == EINVAL) {
          // expect this value when restarting -- not an error
          err = 0;
        } else if (errno == EINTR) {
          // poll was interrupted by a signal -- while loop retries
        } else {
          // HANDLE ERROR HERE
        }
      }
    } while (err < 0);
    close(cr_args.cr_fd);
    statements; //place2
    ...
    //place3: SAME AS PLACE1
    statements; //place4
    ...
    
    
    -- 
    Paul H. Hargrove                          PHHargrove_at_lbl_dot_gov
    Future Technologies Group                 
    HPC Research Department                   Tel: +1-510-495-2352
    Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
    

  • Next message: Paul H. Hargrove: "BLCR 0.6.2 beta1 now available"