Skip to content

Commit

Permalink
Merge pull request #991 from darshan-hpc/snyder/dev-lustre-pfl
Browse files Browse the repository at this point in the history
enhanced Lustre module
  • Loading branch information
shanedsnyder authored Sep 24, 2024
2 parents c28416f + 893cf0d commit 8c7f9d2
Show file tree
Hide file tree
Showing 17 changed files with 853 additions and 744 deletions.
12 changes: 6 additions & 6 deletions darshan-runtime/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,14 @@ if test "x$enable_darshan_runtime" = xyes ; then
AC_CHECK_HEADER([lustre/lustreapi.h],
[AC_CHECK_LIB(lustreapi, llapi_layout_get_by_xattr,
[BUILD_LUSTRE_MODULE=1
DARSHAN_LUSTRE_LD_FLAGS="-llustreapi"],
[AS_IF([test "x$enable_lustre_mod" = xyes],
DARSHAN_LUSTRE_LD_FLAGS="-llustreapi"
enable_lustre_mod=yes],
[AS_IF([test "x$enable_lustre_mod" = xyes],
[AC_MSG_ERROR(Cannot find required llapi_layout_get_by_xattr function for the Lustre module)])
])
AS_IF([test "x$enable_lustre_mod" = xyes],
enable_lustre_mod=no])],
[AS_IF([test "x$enable_lustre_mod" = xyes],
[AC_MSG_ERROR(Cannot find required headers for the Lustre module)])
enable_lustre_mod=yes],
[enable_lustre_mod=no])
enable_lustre_mod=no])
fi

AC_ARG_ENABLE([mdhim-mod],
Expand Down
1 change: 0 additions & 1 deletion darshan-runtime/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ endif
H_SRCS = darshan-common.h \
darshan.h \
darshan-config.h \
darshan-lustre.h \
darshan-dxt.h \
darshan-ldms.h \
uthash.h \
Expand Down
70 changes: 20 additions & 50 deletions darshan-runtime/lib/darshan-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void (*mod_static_init_fns[])(void) =
/* XXX need to use extern to get Lustre module's instrumentation function
* since modules have no way of providing this to darshan-core
*/
extern void darshan_instrument_lustre_file(const char *filepath, int fd);
extern void darshan_instrument_lustre_file(darshan_record_id rec_id, int fd);
#endif

/* prototypes for internal helper functions */
Expand Down Expand Up @@ -958,36 +958,6 @@ static void add_entry(char* buf, int* space_left, struct mntent* entry)
else
mnt_data_array[mnt_data_count].fs_info.block_size = 4096;

#ifdef DARSHAN_LUSTRE
/* attempt to retrieve OST and MDS counts from Lustre */
mnt_data_array[mnt_data_count].fs_info.ost_count = -1;
mnt_data_array[mnt_data_count].fs_info.mdt_count = -1;
if ( statfsbuf.f_type == LL_SUPER_MAGIC )
{
int n_ost, n_mdt;
int ret_ost, ret_mdt;
DIR *mount_dir;

mount_dir = opendir( entry->mnt_dir );
if ( mount_dir )
{
/* n_ost and n_mdt are used for both input and output to ioctl */
n_ost = 0;
n_mdt = 1;

ret_ost = ioctl( dirfd(mount_dir), LL_IOC_GETOBDCOUNT, &n_ost );
ret_mdt = ioctl( dirfd(mount_dir), LL_IOC_GETOBDCOUNT, &n_mdt );

if ( !(ret_ost < 0 || ret_mdt < 0) )
{
mnt_data_array[mnt_data_count].fs_info.ost_count = n_ost;
mnt_data_array[mnt_data_count].fs_info.mdt_count = n_mdt;
}
closedir( mount_dir );
}
}
#endif

/* store mount information with the job-level metadata in darshan log */
ret = snprintf(tmp_mnt, 256, "\n%s\t%s",
entry->mnt_type, entry->mnt_dir);
Expand Down Expand Up @@ -2664,27 +2634,27 @@ void *darshan_core_register_record(
__DARSHAN_CORE_UNLOCK();
return(NULL);
}
}

/* check to see if we've already stored the id->name mapping for
* this record, and add a new name record if not
*/
HASH_FIND(hlink, __darshan_core->name_hash, &rec_id,
sizeof(darshan_record_id), ref);
if(!ref)
{
ret = darshan_add_name_record_ref(__darshan_core, rec_id, name, mod_id);
if(ret == 0)
{
DARSHAN_MOD_FLAG_SET(__darshan_core->log_hdr_p->partial_flag, mod_id);
__DARSHAN_CORE_UNLOCK();
return(NULL);
}
}
else
/* check to see if we've already stored the id->name mapping for
* this record, and add a new name record if not
*/
HASH_FIND(hlink, __darshan_core->name_hash, &rec_id,
sizeof(darshan_record_id), ref);
if(!ref)
{
ret = darshan_add_name_record_ref(__darshan_core, rec_id, name, mod_id);
if(ret == 0)
{
DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
DARSHAN_MOD_FLAG_SET(__darshan_core->log_hdr_p->partial_flag, mod_id);
__DARSHAN_CORE_UNLOCK();
return(NULL);
}
}
else
{
DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
}

__darshan_core->mod_array[mod_id]->rec_mem_avail -= rec_size;
if((mod_id != DXT_POSIX_MOD) && (mod_id != DXT_MPIIO_MOD))
Expand Down Expand Up @@ -2731,7 +2701,7 @@ char *darshan_core_lookup_record_name(darshan_record_id rec_id)
return(name);
}

void darshan_instrument_fs_data(int fs_type, const char *path, int fd)
void darshan_instrument_fs_data(int fs_type, darshan_record_id rec_id, int fd)
{
#ifdef DARSHAN_LUSTRE
/* allow Lustre to generate a record if we configured with Lustre support */
Expand All @@ -2745,7 +2715,7 @@ void darshan_instrument_fs_data(int fs_type, const char *path, int fd)
*/
if(1 || fs_type == LL_SUPER_MAGIC)
{
darshan_instrument_lustre_file(path, fd);
darshan_instrument_lustre_file(rec_id, fd);
return;
}
#endif
Expand Down
Loading

0 comments on commit 8c7f9d2

Please sign in to comment.