#include <stdio.h>#include <lsf/lsf.h>void main(){char *clustername;clustername = ls_getclustername();if (clustername == NULL) {ls_perror("ls_getclustername");exit(-1);}printf("My cluster name is: <%s>\n", clustername);exit(0);}
This simple example gets the name of the Platform LSF cluster and prints it on the screen. The LSLIB function call ls_getclustername() returns the name of the local cluster. If this call fails, it returns a NULL pointer. ls_perror() prints the error message corresponding to the most recently failed LSLIB function call.
The above program would produce output similar to the following:
#include <stdio.h>#include<lsf/lsbatch.h>int main(){struct parameterInfo *parameters;if (lsb_init(NULL) < 0) {lsb_perror("lsb_init");exit(-1);}parameters = lsb_parameterinfo(NULL, NULL, 0);if (parameters == NULL) {lsb_perror("lsb_parameterinfo");exit(-1);}/* Got parameters from mbatchd successfully. Now print out the fields */printf("Job acceptance interval: every %d dispatch turns\n",parameters->jobAcceptInterval);/* Code that prints other parameters goes here *//* ... */exit(0);}
This example gets the LSF batch parameters and prints them on the screen. The function lsb_init() must be called before any other LSBLIB function is called.