Skip to content

Commit

Permalink
mdtest: Add new IBM Spectrum Scale createsharing hint (#439)
Browse files Browse the repository at this point in the history
Add below option to mdtest to optimize performance on IBM
Spectrum Scale version later than 5.1.5.
createsharing : This hint optimizes the performance of workloads that
                create many files in a shared directory

Fixes #435

Signed-off-by: Pidad D'Souza <pidsouza@in.ibm.com>

Signed-off-by: Pidad D'Souza <pidsouza@in.ibm.com>
  • Loading branch information
Pidad committed Sep 28, 2022
1 parent fd4eba1 commit 06fc08e
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 2 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ AS_IF([test "$ac_cv_header_gpfs_h" = "yes" -o "$ac_cv_header_gpfs_fcntl_h" = "ye
])
AC_CHECK_TYPES([gpfsFineGrainWriteSharing_t], [], [], [[#include <gpfs_fcntl.h>]])
AC_CHECK_TYPES([gpfsFineGrainReadSharing_t], [], [], [[#include <gpfs_fcntl.h>]])
AC_CHECK_TYPES([gpfsCreateSharing_t], [], [], [[#include <gpfs_fcntl.h>]])
])
])

Expand Down
5 changes: 4 additions & 1 deletion doc/USER_GUIDE
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,17 @@ GPFS-SPECIFIC (POSIX-ONLY):

* --posix.gpfs.releasetoken - immediately after opening or creating file, release
all locks. Might help mitigate lock-revocation
traffic when many processes write/read to same file.
traffic when many processes write/read to same file

* --posix.gpfs.finegrainwritesharing - This hint optimizes the performance of small strided
writes to a shared file from a parallel application

* --posix.gpfs.finegrainreadsharing - This hint optimizes the performance of small strided
reads from a shared file from a parallel application

* --posix.gpfs.createsharing - This hint optimizes the performance of workloads that
create many files in a shared directory

BeeGFS-SPECIFIC (POSIX-ONLY):
================
* --posix.beegfs.NumTargets - set the number of storage targets to use
Expand Down
4 changes: 3 additions & 1 deletion src/aiori-POSIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ option_help * POSIX_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_o
{0, "posix.gpfs.finegrainwritesharing", " Enable fine grain write sharing", OPTION_FLAG, 'd', & o->gpfs_finegrain_writesharing},
{0, "posix.gpfs.finegrainreadsharing", " Enable fine grain read sharing", OPTION_FLAG, 'd', & o->gpfs_finegrain_readsharing},
#endif

#ifdef HAVE_GPFSCREATESHARING_T
{0, "posix.gpfs.createsharing", " Enable efficient file creation in a shared directory", OPTION_FLAG, 'd', & o->gpfs_createsharing},
#endif
#endif // HAVE_GPFS_FCNTL_H
#ifdef HAVE_LUSTRE_USER
{0, "posix.lustre.stripecount", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_stripe_count},
{0, "posix.lustre.stripesize", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_stripe_size},
Expand Down
2 changes: 2 additions & 0 deletions src/aiori-POSIX.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ typedef struct{
creating or opening a file */
int gpfs_finegrain_writesharing; /* Enable fine grain write sharing */
int gpfs_finegrain_readsharing; /* Enable fine grain read sharing */
int gpfs_createsharing; /* Enable efficient file creation in
a shared directory */

/* beegfs variables */
int beegfs_numTargets; /* number storage targets to use */
Expand Down
57 changes: 57 additions & 0 deletions src/mdtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@

#include <mpi.h>

#ifdef HAVE_GPFSCREATESHARING_T
#include <gpfs_fcntl.h>
#include "aiori-POSIX.h"
#ifndef open64 /* necessary for TRU64 -- */
# define open64 open /* unlikely, but may pose */
#endif /* not open64 */ /* conflicting prototypes */
#endif /* HAVE_GPFSCREATESHARING_T */

#pragma GCC diagnostic ignored "-Wformat-overflow"

#ifdef HAVE_LUSTRE_LUSTREAPI
Expand Down Expand Up @@ -1135,6 +1143,37 @@ int updateStoneWallIterations(int iteration, uint64_t items_done, double tstart,
return hit;
}

#ifdef HAVE_GPFSCREATESHARING_T
void gpfs_createSharing(char *testDirName, int enable)
{
int fd, rc;
int fd_oflag = O_RDONLY;

struct
{
gpfsFcntlHeader_t header;
gpfsCreateSharing_t fcreate;
} createSharingHint;

createSharingHint.header.totalLength = sizeof(createSharingHint);
createSharingHint.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
createSharingHint.header.fcntlReserved = 0;

createSharingHint.fcreate.structLen = sizeof(createSharingHint.fcreate);
createSharingHint.fcreate.structType = GPFS_CREATE_SHARING;
createSharingHint.fcreate.enable = enable;

fd = open64(testDirName, fd_oflag);
if (fd < 0)
ERRF("open64(\"%s\", %d) failed: %s", testDirName, fd_oflag, strerror(errno));

rc = gpfs_fcntl(fd, &createSharingHint);
if (verbose >= VERBOSE_2 && rc != 0) {
WARNF("gpfs_fcntl(%d, ...) create sharing hint failed. rc %d", fd, rc);
}
}
#endif /* HAVE_GPFSCREATESHARING_T */

void file_test_create(const int iteration, const int ntasks, const char *path, rank_progress_t * progress, double *t_start){
char temp_path[MAX_PATHLEN];
for (int dir_iter = 0; dir_iter < o.directory_loops; dir_iter ++){
Expand Down Expand Up @@ -1203,12 +1242,30 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
if (o.create_only ) {
phase_prepare();
t_start = GetTimeStamp();
#ifdef HAVE_GPFSCREATESHARING_T
/* Enable createSharingHint */
posix_options_t * hint_backend_option = (posix_options_t*) o.backend_options;
if (hint_backend_option->gpfs_createsharing)
{
sprintf(temp_path, "%s/%s", o.testdir, path);
VERBOSE(3,5,"file_test: GPFS Hint enable directory path is '%s'", temp_path);
gpfs_createSharing(temp_path, 1);
}
#endif /* HAVE_GPFSCREATESHARING_T */
progress->stone_wall_timer_seconds = o.stone_wall_timer_seconds;
progress->items_done = 0;
progress->start_time = GetTimeStamp();
file_test_create(iteration, ntasks, path, progress, &t_start);
t_end_before_barrier = GetTimeStamp();
phase_end();
#ifdef HAVE_GPFSCREATESHARING_T
/* Disable createSharingHint */
if (hint_backend_option->gpfs_createsharing)
{
VERBOSE(3,5,"file_test: GPFS Hint disable directory path is '%s'", temp_path);
gpfs_createSharing(temp_path, 0);
}
#endif /* HAVE_GPFSCREATESHARING_T */
t_end = GetTimeStamp();
updateResult(res, MDTEST_FILE_CREATE_NUM, o.items, t_start, t_end, t_end_before_barrier);
}else{
Expand Down

0 comments on commit 06fc08e

Please sign in to comment.