Functions | Variables

gs_sequence.c File Reference

#include "gs_sequence.h"
Include dependency graph for gs_sequence.c:

Go to the source code of this file.

Functions

void grpc_sequence_begin (int mode)
double grpc_sequence_end (int n,...)
int grpc_submit (char *name,...)
int grpc_submit_arg_stack (char *name, grpc_arg_stack *arg_stack)
int grpc_get_sequence_mode ()
GS_DAG_t * grpc_get_sequence ()

Variables

GS_DAG_t * GS_SEQ_DAG = NULL
int grpc_sequence_mode
int grpc_sequence_language
int grpc_sequence_major

Function Documentation

GS_DAG_t* grpc_get_sequence (  ) 

Get the current global GridSolve sequencing DAG

Parameters:
 
Returns:
the DAG

Definition at line 217 of file gs_sequence.c.

                              {
    return GS_SEQ_DAG;
}

int grpc_get_sequence_mode (  ) 

Get the current sequencing mode

Parameters:
 
Returns:
the current sequencing mode

Definition at line 204 of file gs_sequence.c.

                             {
    /* return the current sequencing mode */
    return grpc_sequence_mode;
}

Here is the caller graph for this function:

void grpc_sequence_begin ( int  mode  ) 

Mark the begin of a GridRPC sequence

Returns:

Definition at line 42 of file gs_sequence.c.

                                   {
    /* set the sequencing mode to what is specified */
    grpc_sequence_mode = mode;
    /* set the sequencing language to default */
    grpc_sequence_language = GS_CALL_FROM_C;
    /* set the sequencing major to what is specified */
    grpc_sequence_major = 'r';

    /* make a new empty DAG */
    GS_SEQ_DAG = make_new_GS_DAG();
    if (GS_SEQ_DAG == NULL) {
        fprintf(stderr, "can't make sequencing DAG\n");
        exit(1);
    }

    printf("\n**********************************************\n");
    printf("Beginning a sequence ...\n\n");
}

Here is the call graph for this function:

double grpc_sequence_end ( int  n,
  ... 
)

Mark the end of a GridRPC sequence Schedule and run the sequence

Parameters:
@return 

Definition at line 69 of file gs_sequence.c.

                                     {
    int status;
    double bt, et;
    va_list arg_list;

    va_start(arg_list, n);

    /* ---------------------- analyze and schedule DAG --------------------- */

    printf("Analyzing and building the DAG ...\n");
    /* analyze the dependencies of the
       current sequencing DAG */
    if ((status = analyze_dep_GS_DAG(GS_SEQ_DAG)) < 0) {
        fprintf(stderr, "error analyzing DAG\n");
        exit(1);
    }

    /* output the analyzed DAG to a dot graph */
    output_GS_DAG_to_dot(GS_SEQ_DAG, "pre_analysis.dot"); 

    printf("Post-analyzing the DAG ...\n");
    /* post analysis for DAG optimization */
    if ((status = post_analysis_GS_DAG(GS_SEQ_DAG, arg_list, n)) < 0) {
        fprintf(stderr, "error doing post-DAG-analysis\n");
        exit(1);
    }

    /*output the analyzed DAG to a dot graph */
    output_GS_DAG_to_dot(GS_SEQ_DAG, "post_analysis.dot");
 
    printf("Mapping the DAG to servers ...\n");
    /* map the DAG to servers - scheduling */   
    if ((status = map_to_servers_GS_DAG(GS_SEQ_DAG, AGENT)) < 0) {
        fprintf(stderr, "error mapping DAG to servers\n");
        exit(1);
    }

    if (make_new_data_handle_list(GS_SEQ_DAG) < 0) {
        fprintf(stderr, "error creating data handle list\n");
        exit(1);
    }

    if (gs_seq_set_lfs_dsi_data_storage_path() < 0) {
        exit(1);
    }
    
    /* --------------------------- execute DAG ----------------------------- */
    printf("\nExecuting the DAG ...\n");
    
    bt = walltime();
    
    /* execute the DAG */
    if ((status = execute_GS_DAG(GS_SEQ_DAG)) < 0) {
        fprintf(stderr, "error executing DAG\n");
        exit(1);
    }
    
    et = walltime();

    /* ---------------------------- finalize ------------------------------- */
    /* turn off the sequencing mode */
    grpc_sequence_mode = OFF_MODE;

    /* free the DAG's memory */
    free_GS_DAG(GS_SEQ_DAG);
    GS_SEQ_DAG = NULL;

    /* free the data handle list */
    free_data_handle_list();

    /* remove all data files */
    if (chdir(DATA_SEND_FILE_PATH) < 0) {
        fprintf(stderr, "error changing directory\n");
        return -1;
    }

    system("rm *.dat");

    printf("\nSequence done.\n");
    printf("**********************************************\n\n");

    return et - bt;
}

Here is the call graph for this function:

int grpc_submit ( char *  name,
  ... 
)

Submit a GridRPC sequence request

Parameters:
name -- the name of the problem to be solved
 
Returns:
0 on success, -1 on failure

Definition at line 162 of file gs_sequence.c.

                                 {
    gs_va_list *arg_list;

    if (name == NULL) return -1;

    arg_list = (gs_va_list *) malloc(sizeof(gs_va_list));
    if (arg_list == NULL) {
        perror("malloc");
        exit(1);
    }

    /* create the variable argument list */
    va_start(arg_list->args, name);

    /* insert a new node into the DAG */
    return insert_node_GS_DAG(GS_SEQ_DAG, name, arg_list, NULL);
}

Here is the call graph for this function:

int grpc_submit_arg_stack ( char *  name,
grpc_arg_stack *  arg_stack 
)

Submit a GridRPC sequence request

Parameters:
name -- the name of the problem to be solved
 
Returns:
0 on success, -1 on failure

Definition at line 189 of file gs_sequence.c.

                                                                 {
    if (name == NULL || arg_stack == NULL) return -1;
    
    /* insert a new node into the DAG */
    return insert_node_GS_DAG(GS_SEQ_DAG, name, NULL, arg_stack);
}

Here is the call graph for this function:


Variable Documentation

Definition at line 30 of file gs_sequence.c.

Definition at line 33 of file gs_sequence.c.

Definition at line 24 of file gs_sequence.c.

GS_DAG_t* GS_SEQ_DAG = NULL

Definition at line 11 of file gs_sequence.c.