Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

export LD_LIBRARY_PATH=/usr/lib/libdrmaa2.so ./<drmaa2_app>


IFL call mapping with C-Style and CPP-style binding<TBD>


C-style binding CPP-style bindingIFL call
void drmaa2_jsession_free(drmaa2_jsession * js);

void drmaa2_rsession_free(drmaa2_rsession * rs);

void drmaa2_msession_free(drmaa2_msession * ms);

void drmaa2_j_free (drmaa2_j * j);

void drmaa2_jarray_free (drmaa2_jarray * ja);

void drmaa2_r_free (drmaa2_r * r);

drmaa2_string drmaa2_rsession_get_contact (const drmaa2_rsession rs);

drmaa2_string drmaa2_rsession_get_session_name (const drmaa2_rsession rs);

drmaa2_r drmaa2_rsession_get_reservation (const drmaa2_rsession rs, const drmaa2_string reservationId);
pbs_statresv
drmaa2_r drmaa2_rsession_request_reservation (const drmaa2_rsession rs, const drmaa2_rtemplate rt);
pbs_submit_resv
drmaa2_r_list drmaa2_rsession_get_reservations (const drmaa2_rsession rs);
pbs_statresv
drmaa2_string drmaa2_r_get_id (const drmaa2_r r);

drmaa2_string drmaa2_r_get_session_name (const drmaa2_r r);

drmaa2_rtemplate drmaa2_r_get_reservation_template (const drmaa2_r r);

drmaa2_rinfo drmaa2_r_get_info (const drmaa2_r r);

drmaa2_error drmaa2_r_terminate (drmaa2_r r);
pbs_delresv
drmaa2_string drmaa2_jarray_get_id (const drmaa2_jarray ja);

drmaa2_j_list drmaa2_jarray_get_jobs (const drmaa2_jarray ja);

drmaa2_string drmaa2_jarray_get_session_name (const drmaa2_jarray ja);

drmaa2_jtemplate drmaa2_jarray_get_job_template (const drmaa2_jarray ja);

drmaa2_error drmaa2_jarray_suspend (drmaa2_jarray ja);

drmaa2_error drmaa2_jarray_resume (drmaa2_jarray ja);

drmaa2_error drmaa2_jarray_hold (drmaa2_jarray ja);

drmaa2_error drmaa2_jarray_release (drmaa2_jarray ja);

drmaa2_error drmaa2_jarray_terminate (drmaa2_jarray ja);

drmaa2_string drmaa2_jsession_get_contact (const drmaa2_jsession js);

drmaa2_string drmaa2_jsession_get_session_name (const drmaa2_jsession js);

drmaa2_string_list drmaa2_jsession_get_job_categories (const drmaa2_jsession js);

drmaa2_j_list drmaa2_jsession_get_jobs (const drmaa2_jsession js, const drmaa2_jinfo filter);

drmaa2_jarray drmaa2_jsession_get_job_array (const drmaa2_jsession js, const drmaa2_string jobarrayId);

drmaa2_j drmaa2_jsession_run_job (const drmaa2_jsession js, const drmaa2_jtemplate jt);

drmaa2_jarray drmaa2_jsession_run_bulk_jobs (const drmaa2_jsession js, const drmaa2_jtemplate jt, unsigned long begin_index, unsigned long end_index, unsigned long step, unsigned long max_parallel);

drmaa2_j drmaa2_jsession_wait_any_started (const drmaa2_jsession js, const drmaa2_j_list l, const time_t timeout);

drmaa2_j drmaa2_jsession_wait_any_terminated (const drmaa2_jsession js, const drmaa2_j_list l, const time_t timeout);

drmaa2_string drmaa2_j_get_id (const drmaa2_j j);

drmaa2_string drmaa2_j_get_session_name (const drmaa2_j j);

drmaa2_jtemplate drmaa2_j_get_jt (const drmaa2_j j);

drmaa2_error drmaa2_j_suspend (drmaa2_j j);

drmaa2_error drmaa2_j_resume (drmaa2_j j);

drmaa2_error drmaa2_j_hold (drmaa2_j j);

drmaa2_error drmaa2_j_release (drmaa2_j j);

drmaa2_error drmaa2_j_terminate (drmaa2_j j);

drmaa2_jstate drmaa2_j_get_state (const drmaa2_j j, drmaa2_string * substate);

drmaa2_jinfo drmaa2_j_get_info (const drmaa2_j j);

drmaa2_error drmaa2_j_wait_started (const drmaa2_j j, const time_t timeout);

drmaa2_error drmaa2_j_wait_terminated (const drmaa2_j j, const time_t timeout);

drmaa2_r_list drmaa2_msession_get_all_reservations (const drmaa2_msession ms);

drmaa2_j_list drmaa2_msession_get_all_jobs (const drmaa2_msession ms, const drmaa2_jinfo filter);

drmaa2_queueinfo_list drmaa2_msession_get_all_queues (const drmaa2_msession ms, const drmaa2_string_list names);

drmaa2_machineinfo_list drmaa2_msession_get_all_machines (const drmaa2_msession ms, const drmaa2_string_list names);

drmaa2_string drmaa2_get_drms_name (void);

drmaa2_version drmaa2_get_drms_version (void);

drmaa2_string drmaa2_get_drmaa_name (void);

drmaa2_version drmaa2_get_drmaa_version (void);

drmaa2_bool drmaa2_supports (const drmaa2_capability c);

drmaa2_jsession drmaa2_create_jsession (const char * session_name, const char * contact);

drmaa2_rsession drmaa2_create_rsession (const char * session_name, const char * contact);

drmaa2_jsession drmaa2_open_jsession (const char * session_name);

drmaa2_rsession drmaa2_open_rsession (const char * session_name);

drmaa2_msession drmaa2_open_msession (const char * session_name);

drmaa2_error drmaa2_close_jsession (drmaa2_jsession js);

drmaa2_error drmaa2_close_rsession (drmaa2_rsession rs);

drmaa2_error drmaa2_close_msession (drmaa2_msession ms);

drmaa2_error drmaa2_destroy_jsession (const char * session_name);

drmaa2_error drmaa2_destroy_rsession (const char * session_name);

drmaa2_string_list drmaa2_get_jsession_names (void);

drmaa2_string_list drmaa2_get_rsession_names (void);

drmaa2_error drmaa2_register_event_notification (const drmaa2_callback callback);


CPP-Style binding

Code Block
languagecpp
themeEclipse
titleCPP-style class defination
collapsetrue
  
namespace drmaa2 
{
  /** Forward declaration**/
  class  Job;          
  class  JobArray;    
  struct QueueInfo;
  struct MachineInfo;
  struct SlotInfo;
  class  Reservation;  
  class  JobSession;  
  class  JobTemplate;
  class  JobInfo;
  class  ReservationInfo;
  class  ReservationTemplate;


  class callback 
  {
    public:
      virtual void notify (notification notification);
  };
 
  class Reservation 
  {
    public:
      string               getReservationId       (void) const;
      ReservationSession  getSession              (void) const;
      ReservationTemplate getReservationTemplate (void) const;

      ReservationInfo     getInfo                  (void);
      void                 terminate                (void);
  };


  class JobArray 
  {
    public:
      string       getJobArrayId   (void) const;
      vector <Job> getJobs           (void) const;
      JobSession  getSession        (void) const;
      JobTemplate getJobTemplate   (void) const;

      void         suspend            (void);
      void         resume             (void);
      void         hold               (void);
      void         release            (void);
      void         terminate          (void);
  };

  /**    
    Every ReservationSession instance acts as container for advance reservations
     in the DRM system. Every Reservation instance SHALL belong only to one
        ReservationSession instance
  */
  class ReservationSession 
  {
    public:
      string            getContact         (void) const;
      string            getSessionName    (void) const;

      Reservation       getReservation      (string               reservationId);
      Reservation       requestReservation  (ReservationTemplate reservationTemplate);
      set <Reservation> getReservations     (void);
  };

  /**
     A job session instance acts as container for job instances controlled
     through the DRMAA API. The session methods support the submission of new
     jobs and the monitoring of existing jobs
  */

  class JobSession 
  {
    public:
      string       getSontact        (void) const;
      string       getSessionName   (void) const;
      set <string> getJobCategories (void) const;

      vector <job> getJobs            (JobInfo       filter);
      JobArray    getJobArray        (string         jobArrayId);
      job          runJob             (JobTemplate   jobTemplate);

      JobArray    runBulkJobs        (JobTemplate   jobTemplate,
                                       long           beginIndex,
                                       long           endIndex,
                                       long           step,
                                       long           maxParallel);
      job          waitAnyStarted     (vector <job> jobs, time_t timeout);
      job          waitAnyTerminated  (vector <job> jobs, time_t timeout);
  };

  /**
    The MonitoringSession interface provides a set of stateless methods for 
    fetching information about the DRM system and the DRMAA implementation itself.
  */
  class MonitoringSession 
  {
    public:
      set <Reservation>  getAllReservations (void);
      vector <Job>       getAllJobs         (JobInfo     filter);
      set <QueueInfo>   getAllQueues       (set <string> names);
      set <MachineInfo> getAllMachines     (set <string> names);
  };
  /**
    The SessionManager interface is the main interface of a DRMAA implementation for
        establishing communication with the DRM system. By the help of this interface, sessions
        for job management, monitoring,and/or reservation management can be maintained.
   */

  class SessionManager 
  {
    public:
      string              getDrmsName             (void) const;
      version             getDrmsVersion          (void) const;
      version             getDrmaaVersion         (void) const;

      bool                supports                  (capability          capability);
      JobSession         createJobSession          (string              sessionName, 
                                                     string              contactString);
      ReservationSession createReservationSession  (string              sessionName,  
                                                     string              contactString);
      MonitoringSession  createMonitoringSession   (string              contactString);
      JobSession         openJobSession            (string              sessionName);
      ReservationSession openReservationSession    (string              sessionName);
      void                closeJobSession           (JobSession         s);
      void                closeReservationSession   (ReservationSession s);
      void                closeMonitoringSession    (MonitoringSession  s);
      void                destroyJobSession         (string              sessionName);
      void                destroyReservationSession (string              sessionName);
      set <string>        getJobSessions            (void);
      set <string>        getReservationSessions    (void);
      void                registerEventNotification (callback            callback);
  };
};


...

Code Block
languagecpp
themeEclipse
titleExample1: DRMAA2 Simple Application
linenumberstrue
collapsetrue
 	drmaa2_jsession js; /* Job session object*/		
    drmaa2_jtemplate jt; /* Job session template*/ object*/		
    drmaa2_jtemplate jt; /* Job session template*/
    drmaa2_j j;  /* Job object*/
    ...
    ...
	...
    /* Create and open job session */
    js = drmaa2_create_jsession("testsession", DRMAA2_UNSET_STRING);
    if (js == NULL) {
   		 ...
      drmaa2_j jreturn;
 /*  Job object*/}
    ...
     ...
	...

    /* Create and open job sessiontemplate */
    jsjt = drmaa2_jtemplate_create();
    jt->remoteCommand = strdup("/bin/date");
    j = drmaa2_jsession("testsession", DRMAA2_UNSET_STRING);
    if (js == NULL) {
   		 _run_job(js, jt);

    ...
	...
    drmaa2_j_wait_terminated(j, DRMAA2_INFINITE_TIME);
    drmaa2_jtemplate_free(&jt);
    drmaa2_destroy_jsession("testsession");
    ...
    ...
	...
    drmaa2_j_free(&j);
    returndrmaa2_jsession_free(&js);
    }...
    ...
	...
Code Block
languagecpp
themeEclipse
titleExample2: DRMAA2 Advance Application
linenumberstrue
collapsetrue
 	...
    ...
	...
    drmaa2_jtemplate        jt = drmaa2_jtemplate_create(); /* Create job template object */
    drmaa2_rtemplate     jt   rt = drmaa2_jtemplatertemplate_create(); /* reservation template object */
 jt->remoteCommand = strdup("/bin/date");   drmaa2_string_list      jcl = drmaa2_jsessionlist_run_job(jscreate(DRMAA2_STRINGLIST, jtNULL); / *create list of  ...
	...strings */
    drmaa2_j_wait_terminated(j, DRMAA2_INFINITE_TIME);dict         drmaa2_jtemplate_free(&jt);   env = drmaa2_destroydict_jsessioncreate("testsession"NULL); /* create a dictionary ...*/

   ...
	...
    drmaa2_jsession js = drmaa2_jcreate_free(&j);
    drmaa2_jsession_free(&js);
    ...jsession("myjsession", NULL); /* open sessions to DRM system */
    if (js == NULL) {
      ... 	...
Code Block
languagecpp
themeEclipse
titleExample2: DRMAA2 Advance Application
linenumberstrue
collapsetrue
 	...
        ...
	...        return;
 drmaa2_jtemplate   }
    jtdrmaa2_rsession rs = drmaa2_jtemplatecreate_create(rsession("myrsession", NULL); /* create joba templatereservation objectsession */
    if (rs == NULL)
    {
        ...
  drmaa2_rtemplate      ...
 rt = drmaa2_rtemplate_create(); /* reservation template object */return;
    drmaa2_string_list}
    drmaa2_msession clms = drmaa2_listopen_createmsession(DRMAA2_STRINGLIST, NULL); 					 / *create and listopen ofmonitoring stringssession */

    ml = drmaa2_dict_msession_get_all_machines(ms, DRMAA2_UNSET_LIST);        /* determine name of first machine */
  env  =if (drmaa2_dictlist_createsize(NULLml); /*< create1) a{
dictionary */   	...
  drmaa2_jsession js = drmaa2_create_jsession("myjsession", NULL); /* open sessionsreturn;
to DRM system */ }
   if (jsm == NULL) {(drmaa2_machineinfo)drmaa2_list_get(ml, 0);
    drmaa2_list_add(cl, m->name);

 ...   rt->maxSlots = 4;    ...         return;     }     drmaa2_rsession rs = drmaa2_create_rsession("myrsession", NULL); /* create a reservation session */     if (rs == NULL)     {         .../* perform advance reservation */
    ...
    rt->machineOS=DRMAA2_LINUX;
   return; rt->candidateMachines = cl;
 }   r = drmaa2_msession ms_rsession_request_reservation(rs, rt);

    jt->remoteCommand = drmaa2_open_msession(NULLstrdup("/bin/date"); 					 /*create and open monitoring session */              ml = drmaa2_msession_get_all_machines(ms, DRMAA2_UNSET_LIST);        /* determine name of/* firstsubmit machinejob */
    jt->reservationId if= (drmaa2_r_listget_sizeid(mlr);
< 1) {  drmaa2_dict_set(env,   	...
        return;
    }"PBS_SCP", "/usr/bin/scp");
    jt->jobEnvironment = env;
    mj = (drmaa2_machineinfo)drmaa2jsession_listrun_getjob(mljs, 0jt);

    drmaa2_j_listwait_addterminated(clj, m->nameDRMAA2_INFINITE_TIME);      rt->maxSlots = 4;          /* Wait for termination and print exit status */
    ji = drmaa2_j_get_info(j);
    ...
	...
	...

    /* close sessions, cleanup */
    drmaa2_jtemplate_free(&jt);
    /* perform advance reservation */
drmaa2_rtemplate_free(&rt);
    drmaa2_jinfo_free(&ji);
   ...
    rt->machineOS=DRMAA2_LINUX drmaa2_j_free(&j);
    rt->candidateMachines = cldrmaa2_r_free(&r);

   r = drmaa2_rsessionclose_request_reservation(rs, rtmsession(ms);
     jt->remoteCommand = strdup("/bin/date"drmaa2_close_rsession(rs);
    drmaa2_close_jsession(js);
    drmaa2_msession_free(&ms);
    drmaa2_rsession_free(&rs);
    drmaa2_jsession_free(&js);

    ...
  /* submit job */
    jt->reservationId = drmaa2_r_get_id(r);
    drmaa2_dict_set(env, "PBS_SCP", "/usr/bin/scp");
    jt->jobEnvironment = env;
    j = drmaa2_jsession_run_job(js, jt);

    drmaa2_j_wait_terminated(j, DRMAA2_INFINITE_TIME);                  /* Wait for termination and print exit status */
    ji = drmaa2_j_get_info(j);
    ...
	...
	...

    /* close sessions, cleanup */
    drmaa2_jtemplate_free(&jt);
    drmaa2_rtemplate_free(&rt);
    drmaa2_jinfo_free(&ji);
    drmaa2_j_free(&j);
    drmaa2_r_free(&r);

    drmaa2_close_msession(ms);
    drmaa2_close_rsession(rs);
    drmaa2_close_jsession(js);
    drmaa2_msession_free(&ms);
    drmaa2_rsession_free(&rs);
    drmaa2_jsession_free(&js);

    ...
    ...

Questions

...

Question

...

Outcome

Not Doing

References

...

...

Questions

Question

Outcome


Not Doing


References

forward defalcation required for API

IFL call


drmaa2_get_drms_name (void);
drmaa2_get_drms_version (void);
drmaa2_get_drmaa_name (void);
drmaa2_get_drmaa_version (void);
drmaa2_supports (const drmaa2_capability c);
drmaa2_create_jsession (const char * session_name, const char * contact);
drmaa2_create_rsession (const char * session_name, const char * contact);
drmaa2_open_jsession (const char * session_name);
drmaa2_open_rsession (const char * session_name);
drmaa2_open_msession (const char * session_name);
drmaa2_close_jsession (drmaa2_jsession js);
drmaa2_close_rsession (drmaa2_rsession rs);
drmaa2_close_msession (drmaa2_msession ms);
drmaa2_destroy_jsession (const char * session_name);
drmaa2_destroy_rsession (const char * session_name);
drmaa2_get_jsession_names (void);
drmaa2_get_rsession_names (void);
drmaa2_register_event_notification (const drmaa2_callback callback);