Commit 87bbb92c authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Make alignment on large pages optional.

parent 9c25cefb
......@@ -107,4 +107,13 @@ void cdiPioConfSetPostCommSetupActions(int confResH,
* setup of client/server communications from configuration object */
void (*cdiPioConfGetPostCommSetupActions(int confResH))(void);
/* cdiPioConfSetLargePageAlign should block buffer be aligned to
* large pages instead of normal pages? */
void cdiPioConfSetLargePageAlign(int confResH, int largePageAlign);
/* cdiPioConfSetLargePageAlign: should block buffer be aligned to
* large pages instead of normal pages? */
int cdiPioConfGetLargePageAlign(int confResH);
#endif
......@@ -146,3 +146,16 @@
! PROCEDURE postCommSetupActions)
EXTERNAL cdiPioConfSetPostCommSetupActions
!
! cdiPioConfSetLargePageAlign should block buffer be aligned to
! large pages instead of normal pages?
!
! cdiPioConfSetLargePageAlign
! (INTEGER confResH,
! INTEGER largePageAlign)
EXTERNAL cdiPioConfSetLargePageAlign
INTEGER cdiPioConfGetLargePageAlign
! (INTEGER confResH)
EXTERNAL cdiPioConfGetLargePageAlign
......@@ -81,4 +81,10 @@ FCALLSCFUN1 (INT, cdiPioConfGetCSRole, CDIPIOCONFGETCSROLE, cdipioconfgetcsrole,
#define ROUTINE_2 (void (*)(void))
FCALLSCSUB2 (cdiPioConfSetPostCommSetupActions, CDIPIOCONFSETPOSTCOMMSETUPACTIONS, cdipioconfsetpostcommsetupactions, INT, ROUTINE)
/* cdiPioConfSetLargePageAlign should block buffer be aligned to
* large pages instead of normal pages? */
FCALLSCSUB2 (cdiPioConfSetLargePageAlign, CDIPIOCONFSETLARGEPAGEALIGN, cdipioconfsetlargepagealign, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetLargePageAlign, CDIPIOCONFGETLARGEPAGEALIGN, cdipioconfgetlargepagealign, INT)
#endif
......@@ -142,8 +142,10 @@ cdiPioConfPrintP(void *cdiPioConfPtr, FILE * fp)
"IOMode = %s\n"
"client/server = %s\n"
"part data imbalance = %f\n"
"aligning of block buffers to large pages is %sabled\n"
"callback after setup of communication = %p\n",
cdiPioConfPtr, iomodeStr, CSRoleStr, conf->partInflate,
conf->largePageAlign ? "en" : "dis",
(void *)conf->postCommSetupActions);
}
......@@ -155,6 +157,7 @@ int cdiPioConfCreate(void)
conf->clientServerRole = PIO_ROLE_CLIENT;
conf->partInflate = 1.1f;
conf->postCommSetupActions = cdiPioNoPostCommSetup;
conf->largePageAlign = false;
int resH = reshPut(conf, &cdiPioConfOps);
/* configuration objects are never forwarded */
reshSetStatus(resH, &cdiPioConfOps,
......@@ -219,3 +222,16 @@ void (*cdiPioConfGetPostCommSetupActions(int confResH))(void)
struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps);
return conf->postCommSetupActions;
}
void cdiPioConfSetLargePageAlign(int confResH, int largePageAlign)
{
struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps);
conf->largePageAlign = largePageAlign != 0;
}
int cdiPioConfGetLargePageAlign(int confResH)
{
struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps);
return conf->largePageAlign;
}
#ifndef PIO_CONF_H
#define PIO_CONF_H
#include <stdbool.h>
/*
* declare data structures and functions to manipulate/query CDI-PIO
* configuration object.
......@@ -18,6 +21,7 @@ struct cdiPioConf {
int clientServerRole;
float partInflate;
void (*postCommSetupActions)(void);
bool largePageAlign;
};
extern const resOps cdiPioConfOps;
......@@ -50,4 +54,8 @@ cdiPioIOModeStr2Code(const char *modeStr);
const char *
cdiPioIOMode2Str(int IOMode);
int cdiPioConfGetLargePageAlign(int confResH);
void cdiPioConfSetLargePageAlign(int confResH, int largePageAlign);
#endif
......@@ -9,6 +9,8 @@
#include <mpi.h>
#include "pio_conf.h"
enum IO_Server_command
{
IO_Open_file,
......@@ -100,7 +102,7 @@ void cdiPioFileWriteOrderedInit(void);
void cdiPioFileWriteAtAllInit(void);
/* pio_mpi_fw_at_reblock.c */
void cdiPioFileWriteAtReblockInit(void);
void cdiPioFileWriteAtReblockInit(const struct cdiPioConf *conf);
/* common functionality for file split between collectors and writer(s) */
void pioSendInitialize(void);
......
......@@ -464,7 +464,7 @@ pioInit(MPI_Comm commGlob, int nProcsIO, int IOMode,
return retcomm;
}
static void cdiPioFileWritingInit(void);
static void cdiPioFileWritingInit(const struct cdiPioConf *conf);
MPI_Comm
cdiPioInit(MPI_Comm commGlob, int confResH, int *pioNamespace)
......@@ -510,7 +510,7 @@ cdiPioInit(MPI_Comm commGlob, int confResH, int *pioNamespace)
{
cdiPioSerializeSetMPI();
conf->postCommSetupActions();
cdiPioFileWritingInit();
cdiPioFileWritingInit(conf);
if (commInqRankColl() >= 0)
{
cdiPioCollectorMessageLoop();
......@@ -531,7 +531,7 @@ cdiPioInit(MPI_Comm commGlob, int confResH, int *pioNamespace)
}
static void
cdiPioFileWritingInit(void)
cdiPioFileWritingInit(const struct cdiPioConf *conf)
{
int IOMode = commInqIOMode ();
......@@ -560,7 +560,7 @@ cdiPioFileWritingInit(void)
cdiPioFileWriteAtAllInit();
break;
case PIO_MPI_FW_AT_REBLOCK:
cdiPioFileWriteAtReblockInit();
cdiPioFileWriteAtReblockInit(conf);
break;
}
}
......
......@@ -22,6 +22,7 @@
#include "namespace.h"
#include "pio.h"
#include "pio_comm.h"
#include "pio_conf.h"
#include "pio_impl.h"
#include "pio_rpc.h"
#include "pio_util.h"
......@@ -116,21 +117,37 @@ enum {
commonPageSize = 8192,
};
static bool largePageAlign;
static size_t
getPageSize(void)
{
long pagesize = -1L;
bool nameAssigned = false;
#if HAVE_DECL__SC_LARGE_PAGESIZE || HAVE_DECL__SC_PAGE_SIZE || HAVE_DECL__SC_PAGESIZE
int name =
int name;
#if HAVE_DECL__SC_LARGE_PAGESIZE
_SC_LARGE_PAGESIZE
#elif HAVE_DECL__SC_PAGESIZE
_SC_PAGESIZE
if (largePageAlign)
{
name = _SC_LARGE_PAGESIZE;
nameAssigned = true;
}
else
#endif
{
#if HAVE_DECL__SC_PAGESIZE || HAVE_DECL__SC_PAGE_SIZE
name =
#if HAVE_DECL__SC_PAGESIZE
_SC_PAGESIZE
#elif HAVE_DECL__SC_PAGE_SIZE
_SC_PAGE_SIZE
_SC_PAGE_SIZE
#endif
;
nameAssigned = true;
#endif
;
pagesize = sysconf(name);
}
if (nameAssigned)
pagesize = sysconf(name);
#endif
if (pagesize == -1L)
pagesize =
......@@ -567,7 +584,7 @@ static void finalizeFileWriteAtReblock(void)
/***************************************************************/
void
cdiPioFileWriteAtReblockInit(void)
cdiPioFileWriteAtReblockInit(const struct cdiPioConf *conf)
{
bibAFiledataM = listSetNew( destroyAFiledataFileWriteAtReblock, compareNamesFileWriteAtReblock );
namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(fowFileWriteAtReblock));
......@@ -575,6 +592,8 @@ cdiPioFileWriteAtReblockInit(void)
namespaceSwitchSet(NSSWITCH_FILE_WRITE, NSSW_FUNC(fwFileWriteAtReblock));
cdiPioFileWritingFinalize = finalizeFileWriteAtReblock;
largePageAlign = conf->largePageAlign;
if ( bibAFiledataM == NULL )
xabort ( "listSetNew did not succeed" );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment