Skip to content

Commit f2890c5

Browse files
author
shanedsnyder
authored
Merge pull request #1014 from darshan-hpc/snyder/dev-daos-module-3.4
ENH: DAOS and DFS modules
2 parents 2b5e43f + 4ce04a3 commit f2890c5

35 files changed

+6095
-121
lines changed

darshan-runtime/configure.ac

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,46 @@ if test "x$enable_darshan_runtime" = xyes ; then
487487
use --with-pnetcdf to provide the PnetCDF install prefix, if needed.]))
488488
fi
489489

490+
# inform about DAOS installs not found in default locations
491+
AC_ARG_WITH([daos],
492+
[AS_HELP_STRING([--with-daos@<:@=DIR@:>@],
493+
[Installation directory for DAOS.])],
494+
[], [with_daos=no]
495+
)
496+
497+
# DAOS module (disabled by default)
498+
AC_ARG_ENABLE([daos-mod],
499+
[AS_HELP_STRING([--enable-daos-mod],
500+
[Enables compilation and use of DAOS module])],
501+
[], [enable_daos_mod=no]
502+
)
503+
if test "x$enable_daos_mod" = xyes ; then
504+
AC_CHECK_HEADERS(m4_normalize([daos_types.h daos_prop.h daos_pool.h daos_cont.h
505+
daos_obj.h daos_array.h daos_fs.h]),
506+
[],
507+
[AC_MSG_ERROR([Cannot find required DAOS headers])],
508+
[[
509+
#ifdef HAVE_DAOS_TYPES_H
510+
# include <daos_types.h>
511+
#endif
512+
#ifdef HAVE_DAOS_PROP_H
513+
# include <daos_prop.h>
514+
#endif
515+
#ifdef HAVE_DAOS_CONT_H
516+
# include <daos_cont.h>
517+
#endif
518+
#ifdef HAVE_DAOS_OBJ_H
519+
# include <daos_obj.h>
520+
#endif
521+
#ifdef HAVE_DAOS_ARRAY_H
522+
# include <daos_array.h>
523+
#endif
524+
]])
525+
elif test "x$enable_daos_mod" != xno ; then
526+
AC_MSG_ERROR(m4_normalize([--enable-daos-mod does not take any argument,
527+
use --with-daos to provide the DAOS install prefix, if needed.]))
528+
fi
529+
490530
# BG/Q module
491531
AC_ARG_ENABLE([bgq-mod],
492532
[AS_HELP_STRING([--disable-bgq-mod],
@@ -809,6 +849,7 @@ AM_CONDITIONAL(BUILD_MDHIM_MODULE, [test "x$enable_mdhim_mod" = xyes])
809849
AM_CONDITIONAL(BUILD_APMPI_MODULE, [test "x$enable_apmpi_mod" = xyes])
810850
AM_CONDITIONAL(BUILD_APXC_MODULE, [test "x$enable_apxc_mod" = xyes])
811851
AM_CONDITIONAL(BUILD_HEATMAP_MODULE,[test "x$enable_heatmap_mod" = xyes])
852+
AM_CONDITIONAL(BUILD_DAOS_MODULE, [test "x$enable_daos_mod" = xyes])
812853
AM_CONDITIONAL(HAVE_LDMS, [test "x$enable_ldms_mod" = xyes])
813854

814855
AC_CONFIG_FILES(Makefile \
@@ -884,6 +925,7 @@ if test "x$enable_darshan_runtime" = xyes ; then
884925
AUTOPERF MPI module support - $enable_apmpi_mod
885926
AUTOPERF XC module support - $enable_apxc_mod
886927
HDF5 module support - $enable_hdf5_mod
928+
DAOS module support - $enable_daos_mod
887929
PnetCDF module support - $enable_pnetcdf_mod
888930
BG/Q module support - $enable_bgq_mod
889931
Lustre module support - $enable_lustre_mod

darshan-runtime/doc/darshan-runtime.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ make install
146146
** NOTE: PnetCDF instrumentation only works on PnetCDF library versions >=1.8
147147
* `--disable-lustre-mod`: disables compilation and use of Darshan's Lustre
148148
module (default=enabled)
149+
* `--enable-daos-mod`: enables compilation and use of Darshan's DAOS module
150+
(default=disabled)
151+
* `--with-daos=DIR`: installation directory for DAOS
152+
** NOTE: Users must call `--enable-daos-mod` to enable DAOS modules, `--with-daos` is only used to additionally provide a DAOS install prefix.
149153
* `--enable-mdhim-mod`: enables compilation and use of Darshan's MDHIM module
150154
(default=disabled)
151155
* `--enable-ldms-mod`: enables compilation and use of Darshan’s LDMS runtime module (default=disabled)

darshan-runtime/lib/Makefile.am

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ if BUILD_HEATMAP_MODULE
7171
AM_CPPFLAGS += -DDARSHAN_HEATMAP
7272
endif
7373

74+
if BUILD_DAOS_MODULE
75+
C_SRCS += darshan-dfs.c darshan-daos.c
76+
AM_CPPFLAGS += -DDARSHAN_DAOS
77+
endif
78+
7479
.m4.c:
7580
$(M4) $(AM_M4FLAGS) $(M4FLAGS) $< >$@
7681

@@ -138,5 +143,7 @@ EXTRA_DIST = $(H_SRCS) \
138143
darshan-bgq.c \
139144
darshan-lustre.c \
140145
darshan-mdhim.c \
141-
darshan-heatmap.c
146+
darshan-heatmap.c \
147+
darshan-dfs.c \
148+
darshan-daos.c
142149

darshan-runtime/lib/darshan-core.c

Lines changed: 83 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static int darshan_should_instrument_rank(
116116
struct darshan_core_runtime *core);
117117
static void darshan_fs_info_from_path(
118118
const char *path, struct darshan_fs_info *fs_info);
119-
static int darshan_add_name_record_ref(
119+
static int darshan_update_name_record_ref(
120120
struct darshan_core_runtime *core, darshan_record_id rec_id,
121121
const char *name, darshan_module_id mod_id);
122122
static void darshan_get_user_name(
@@ -1301,51 +1301,87 @@ static void darshan_fs_info_from_path(const char *path, struct darshan_fs_info *
13011301
return;
13021302
}
13031303

1304-
static int darshan_add_name_record_ref(struct darshan_core_runtime *core,
1304+
static int darshan_update_name_record_ref(struct darshan_core_runtime *core,
13051305
darshan_record_id rec_id, const char *name, darshan_module_id mod_id)
13061306
{
1307-
struct darshan_core_name_record_ref *ref;
1308-
struct darshan_core_name_record_ref *check_ref;
1309-
int record_size = sizeof(darshan_record_id) + strlen(name) + 1;
1307+
int is_new_rec = 0;
1308+
struct darshan_core_name_record_ref *ref, *check_ref;
13101309

1311-
if((record_size + core->name_mem_used) > core->config.name_mem)
1312-
return(0);
1310+
/* if no name given, use the empty string */
1311+
if(!name) name = "";
13131312

1314-
/* drop core lock while we allocate reference. Note that
1315-
* this means we must check for existence again in hash table once we
1316-
* re-acquire the lock, but this code path will only happen once per
1317-
* file.
1318-
*/
1319-
__DARSHAN_CORE_UNLOCK();
1320-
ref = malloc(sizeof(*ref));
1321-
__DARSHAN_CORE_LOCK();
1313+
/* check to see if we've already stored the id->name mapping for this record */
1314+
HASH_FIND(hlink, core->name_hash, &rec_id, sizeof(rec_id), ref);
13221315
if(!ref)
13231316
{
1324-
return(0);
1325-
}
1326-
memset(ref, 0, sizeof(*ref));
1317+
/* drop core lock while we allocate reference. Note that
1318+
* this means we must check for existence again in hash table once we
1319+
* re-acquire the lock, but this code path will only happen once per
1320+
* file.
1321+
*/
1322+
__DARSHAN_CORE_UNLOCK();
1323+
ref = malloc(sizeof(*ref));
1324+
__DARSHAN_CORE_LOCK();
1325+
if(!ref)
1326+
{
1327+
return(0);
1328+
}
1329+
memset(ref, 0, sizeof(*ref));
13271330

1328-
/* make sure no one else added it while we dropped the lock */
1329-
HASH_FIND(hlink, core->name_hash, &rec_id,
1330-
sizeof(darshan_record_id), check_ref);
1331-
if(check_ref)
1332-
return(1);
1331+
HASH_FIND(hlink, core->name_hash, &rec_id, sizeof(rec_id), check_ref);
1332+
if(check_ref)
1333+
{
1334+
/* someone else added the ref while we dropped the lock */
1335+
free(ref);
1336+
ref = check_ref;
1337+
}
1338+
else
1339+
{
1340+
/* we need to allocate and add a new record ref */
1341+
is_new_rec = 1;
1342+
}
1343+
}
13331344

1334-
/* initialize the name record */
1335-
ref->name_record = (struct darshan_name_record *)
1336-
((char *)core->log_name_p + core->name_mem_used);
1337-
memset(ref->name_record, 0, record_size);
1338-
ref->name_record->id = rec_id;
1339-
strcpy(ref->name_record->name, name);
1340-
DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
1345+
/* set a new name record reference in 2 scenarios:
1346+
* 1.) creation of a new record ref
1347+
* 2.) detecting zero-length name on an existing record ref
1348+
* (i.e., initial creator of the ref didn't specify a name)
1349+
*/
1350+
if(is_new_rec || ((strlen(ref->name_record->name) == 0) && strlen(name) > 0))
1351+
{
1352+
int record_size = sizeof(darshan_record_id) + strlen(name) + 1;
1353+
if((record_size + core->name_mem_used) > core->config.name_mem)
1354+
{
1355+
/* no more room for this name record */
1356+
if(is_new_rec) free(ref);
1357+
return(0);
1358+
}
1359+
else
1360+
{
1361+
/* initialize new name record structure */
1362+
ref->name_record = (struct darshan_name_record *)
1363+
((char *)core->log_name_p + core->name_mem_used);
1364+
memset(ref->name_record, 0, record_size);
1365+
ref->name_record->id = rec_id;
1366+
strcpy(ref->name_record->name, name);
13411367

1342-
HASH_ADD(hlink, core->name_hash, name_record->id,
1343-
sizeof(darshan_record_id), ref);
1344-
core->name_mem_used += record_size;
1368+
core->name_mem_used += record_size;
13451369
#ifdef __DARSHAN_ENABLE_MMAP_LOGS
1346-
core->log_hdr_p->name_map.len += record_size;
1370+
core->log_hdr_p->name_map.len += record_size;
13471371
#endif
1372+
}
1373+
}
1374+
1375+
DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
13481376

1377+
if(is_new_rec)
1378+
{
1379+
/* add new record reference */
1380+
HASH_ADD(hlink, core->name_hash, name_record->id,
1381+
sizeof(darshan_record_id), ref);
1382+
}
1383+
1384+
/* successfully updated core record ref */
13491385
return(1);
13501386
}
13511387

@@ -2207,6 +2243,9 @@ static int darshan_core_name_is_excluded(const char *name, darshan_module_id mod
22072243
int tmp_index = 0;
22082244
struct darshan_core_regex *regex;
22092245

2246+
if(!name)
2247+
return(0);
2248+
22102249
/* set flag if this module's record names are based on file paths */
22112250
name_is_path = 1;
22122251
if((mod_id == DARSHAN_APMPI_MOD) || (mod_id == DARSHAN_APXC_MOD) ||
@@ -2606,9 +2645,7 @@ void *darshan_core_register_record(
26062645
size_t rec_size,
26072646
struct darshan_fs_info *fs_info)
26082647
{
2609-
struct darshan_core_name_record_ref *ref;
26102648
void *rec_buf;
2611-
int ret;
26122649

26132650
__DARSHAN_CORE_LOCK();
26142651
if(!__darshan_core)
@@ -2625,35 +2662,19 @@ void *darshan_core_register_record(
26252662
return(NULL);
26262663
}
26272664

2628-
/* register a name record if a name is given for this record */
2629-
if(name)
2665+
if(darshan_core_name_is_excluded(name, mod_id))
26302666
{
2631-
if(darshan_core_name_is_excluded(name, mod_id))
2632-
{
2633-
/* do not register record if name matches any exclusion rules */
2634-
__DARSHAN_CORE_UNLOCK();
2635-
return(NULL);
2636-
}
2667+
/* do not register record if name matches any exclusion rules */
2668+
__DARSHAN_CORE_UNLOCK();
2669+
return(NULL);
26372670
}
26382671

2639-
/* check to see if we've already stored the id->name mapping for
2640-
* this record, and add a new name record if not
2641-
*/
2642-
HASH_FIND(hlink, __darshan_core->name_hash, &rec_id,
2643-
sizeof(darshan_record_id), ref);
2644-
if(!ref)
2672+
if(!darshan_update_name_record_ref(__darshan_core, rec_id, name, mod_id))
26452673
{
2646-
ret = darshan_add_name_record_ref(__darshan_core, rec_id, name, mod_id);
2647-
if(ret == 0)
2648-
{
2649-
DARSHAN_MOD_FLAG_SET(__darshan_core->log_hdr_p->partial_flag, mod_id);
2650-
__DARSHAN_CORE_UNLOCK();
2651-
return(NULL);
2652-
}
2653-
}
2654-
else
2655-
{
2656-
DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
2674+
/* unable to update record ref, fail and set this module's partial flag */
2675+
DARSHAN_MOD_FLAG_SET(__darshan_core->log_hdr_p->partial_flag, mod_id);
2676+
__DARSHAN_CORE_UNLOCK();
2677+
return(NULL);
26572678
}
26582679

26592680
__darshan_core->mod_array[mod_id]->rec_mem_avail -= rec_size;
@@ -2683,7 +2704,7 @@ void *darshan_core_register_record(
26832704
if(fs_info)
26842705
darshan_fs_info_from_path(name, fs_info);
26852706

2686-
return(rec_buf);;
2707+
return(rec_buf);
26872708
}
26882709

26892710
char *darshan_core_lookup_record_name(darshan_record_id rec_id)

0 commit comments

Comments
 (0)