Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
88c63df1
Commit
88c63df1
authored
9 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Move getPageSize to pio_util.
parent
f3f0d58e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/pio_mpi_fw_at_reblock.c
+1
-49
1 addition, 49 deletions
src/pio_mpi_fw_at_reblock.c
src/pio_util.c
+46
-0
46 additions, 0 deletions
src/pio_util.c
src/pio_util.h
+9
-0
9 additions, 0 deletions
src/pio_util.h
with
56 additions
and
49 deletions
src/pio_mpi_fw_at_reblock.c
+
1
−
49
View file @
88c63df1
...
...
@@ -112,56 +112,8 @@ lcm(size_t a, size_t b)
return
a
/
gcd
(
a
,
b
)
*
b
;
}
enum
{
/* 8192 is known to work on most systems (4096 isn't on Alpha) */
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
;
#if HAVE_DECL__SC_LARGE_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
#endif
;
nameAssigned
=
true
;
#endif
}
if
(
nameAssigned
)
pagesize
=
sysconf
(
name
);
#endif
if
(
pagesize
==
-
1L
)
pagesize
=
#if HAVE_DECL_PAGESIZE
PAGESIZE
#elif HAVE_DECL_PAGE_SIZE
PAGE_SIZE
#else
commonPageSize
#endif
;
return
(
size_t
)
pagesize
;
}
static
size_t
getXferBufAlign
(
const
char
*
path
)
{
...
...
@@ -220,7 +172,7 @@ initAFiledataFileWriteAtReblock(const char *filename, size_t bufSize)
#undef MINBLOCKSIZE
/* ensure block size also meets page and direct I/O buffer
* alignment requirements */
size_t
pageSize
=
g
etPageSize
(),
size_t
pageSize
=
cdiPioG
etPageSize
(
largePageAlign
),
IOAlign
=
getXferBufAlign
(
filename
);
bufBlockAlign
=
lcm
(
pageSize
,
IOAlign
);
blockSize
=
lcm
(
blockSize
,
bufBlockAlign
);
...
...
This diff is collapsed.
Click to expand it.
src/pio_util.c
+
46
−
0
View file @
88c63df1
...
...
@@ -8,6 +8,8 @@
#include
<stdlib.h>
#include
<string.h>
#include
<unistd.h>
#include
"pio_util.h"
#include
"cdi.h"
#include
"dmemory.h"
...
...
@@ -194,6 +196,50 @@ cdiPioQueryVarDims(int varShape[3], int vlistID, int varID)
return
(
varShape
[
2
]
==
1
)
?
2
:
3
;
}
size_t
cdiPioGetPageSize
(
bool
largePageAlign
)
{
long
pagesize
=
-
1L
;
bool
nameAssigned
=
false
;
#if HAVE_DECL__SC_LARGE_PAGESIZE || HAVE_DECL__SC_PAGE_SIZE || HAVE_DECL__SC_PAGESIZE
int
name
;
#if HAVE_DECL__SC_LARGE_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
#endif
;
nameAssigned
=
true
;
#endif
}
if
(
nameAssigned
)
pagesize
=
sysconf
(
name
);
#endif
if
(
pagesize
==
-
1L
)
pagesize
=
#if HAVE_DECL_PAGESIZE
PAGESIZE
#elif HAVE_DECL_PAGE_SIZE
PAGE_SIZE
#else
commonPageSize
#endif
;
return
(
size_t
)
pagesize
;
}
/****************************************************/
/*
* Local Variables:
...
...
This diff is collapsed.
Click to expand it.
src/pio_util.h
+
9
−
0
View file @
88c63df1
...
...
@@ -105,6 +105,15 @@ void printArray ( const char *, const char *, const void *, int, int, const char
int
cdiPioQueryVarDims
(
int
varShape
[
3
],
int
vlistID
,
int
varID
);
enum
{
/* 8192 is known to work on most systems (4096 isn't on Alpha) */
commonPageSize
=
8192
,
};
size_t
cdiPioGetPageSize
(
bool
largePageAlign
);
#endif
/*
* Local Variables:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment