darshan.h 2.65 KB
Newer Older
1
/*
Shane Snyder's avatar
Shane Snyder committed
2 3 4
 * Copyright (C) 2015 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
5 6
 */

7 8 9 10 11 12 13
#ifndef __DARSHAN_H
#define __DARSHAN_H

#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>
#include <mpi.h>
14

15 16
#include "darshan-log-format.h"

17 18 19 20 21 22 23 24 25 26 27 28
/* Environment variable to override CP_JOBID */
#define CP_JOBID_OVERRIDE "DARSHAN_JOBID"

/* Environment variable to override __CP_LOG_PATH */
#define CP_LOG_PATH_OVERRIDE "DARSHAN_LOGPATH"

/* Environment variable to override __CP_LOG_PATH */
#define CP_LOG_HINTS_OVERRIDE "DARSHAN_LOGHINTS"

/* Environment variable to override __CP_MEM_ALIGNMENT */
#define CP_MEM_ALIGNMENT_OVERRIDE "DARSHAN_MEMALIGN"

Shane Snyder's avatar
Shane Snyder committed
29
/* module developers provide the following functions to darshan-core */
30
struct darshan_module_funcs
31
{
32
    /* disable futher instrumentation within a module */
Shane Snyder's avatar
Shane Snyder committed
33
    void (*disable_instrumentation)(void);
Shane Snyder's avatar
Shane Snyder committed
34
    /* perform any necessary steps prior to reducing */
35
    void (*prepare_for_reduction)(
Shane Snyder's avatar
Shane Snyder committed
36
        darshan_record_id *shared_recs, /* input list of shared records */
37
        int *shared_rec_count, /* in/out shared record count */
Shane Snyder's avatar
Shane Snyder committed
38 39 40
        void **send_buf, /* send buffer for shared file reduction */
        void **recv_buf, /* recv buffer for shared file reduction (root only) */
        int *rec_size /* size of records being stored for this module */
41
    );
Shane Snyder's avatar
Shane Snyder committed
42
    /* reduce records which are shared globally across this module */
43
    void (*record_reduction_op)(
44 45 46 47 48 49
        void* infile_v,
        void* inoutfile_v,
        int *len,
        MPI_Datatype *datatype
    );
    /* retrieve module data to write to log file */
50 51 52 53
    void (*get_output_data)(
        void** buf, /* output parameter to save module buffer address */
        int* size /* output parameter to save module buffer size */
    );
54
    /* shutdown module data structures */
55
    void (*shutdown)(void);
56 57
};

58 59 60
/*****************************************************
* darshan-core functions exported to darshan modules *
*****************************************************/
61

62
void darshan_core_register_module(
63
    darshan_module_id mod_id,
64 65
    struct darshan_module_funcs *funcs,
    int *runtime_mem_limit);
66

67 68 69
void darshan_core_unregister_module(
    darshan_module_id mod_id);

Shane Snyder's avatar
Shane Snyder committed
70
void darshan_core_register_record(
71 72 73
    void *name,
    int len,
    int printable_flag,
74
    darshan_module_id mod_id,
75
    darshan_record_id *rec_id);
76

Shane Snyder's avatar
Shane Snyder committed
77 78 79 80
void darshan_core_unregister_record(
    darshan_record_id rec_id,
    darshan_module_id mod_id);

81
double darshan_core_wtime(void);
82

83 84 85 86 87 88
/***********************************************
* darshan-common functions for darshan modules *
***********************************************/

char* darshan_clean_file_path(const char* path);

89
#endif /* __DARSHAN_H */