Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
swiftmpistepsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
SWIFT
swiftmpistepsim
Commits
f3f691d8
Commit
f3f691d8
authored
4 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Don't overflow when converting to bytes and switch to subtype/rank/size as key
parent
67b2ea44
No related branches found
No related tags found
1 merge request
!8
Draft: RDMA version with wrapped infinity calls
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swiftmpirdmaonestepsim.c
+14
-13
14 additions, 13 deletions
swiftmpirdmaonestepsim.c
with
14 additions
and
13 deletions
swiftmpirdmaonestepsim.c
+
14
−
13
View file @
f3f691d8
...
@@ -90,6 +90,9 @@ static const int task_type_recv = 23;
...
@@ -90,6 +90,9 @@ static const int task_type_recv = 23;
/* Bit shift to accomodate all the bits of the maximum rank id. */
/* Bit shift to accomodate all the bits of the maximum rank id. */
static
int
rank_shift
=
0
;
static
int
rank_shift
=
0
;
/* Bit shift to accomodate all the bits of the maximum subtype. */
static
int
subtype_shift
=
0
;
/* Maximum no. of messages (logs). */
/* Maximum no. of messages (logs). */
static
size_t
max_logs
=
0
;
static
size_t
max_logs
=
0
;
...
@@ -113,18 +116,18 @@ static struct mpiuse_log_entry **volatile recvs_queue[MAX_NR_RANKS];
...
@@ -113,18 +116,18 @@ static struct mpiuse_log_entry **volatile recvs_queue[MAX_NR_RANKS];
static
int
volatile
starting
[
MAX_NR_RANKS
]
=
{
1
};
static
int
volatile
starting
[
MAX_NR_RANKS
]
=
{
1
};
/**
/**
* @brief Convert
two
rank
s
and tag into a single unique value.
* @brief Convert
a
rank
, subtype
and tag into a single unique value.
*
*
* Assumes there is enough space in a size_t for these values.
* Assumes there is enough space in a size_t for these values.
*
*
* @param s
endrank the send rank XXX currently the subtype... XXX
* @param s
ubtype the subtype of the message
* @param recvrank the receive rank
* @param recvrank the receive rank
* @param tag the tag
* @param tag the tag
*
*
* @result a unique value based on both values
* @result a unique value based on both values
*/
*/
static
size_t
toranktag
(
int
s
endrank
,
int
recvrank
,
int
tag
)
{
static
size_t
toranktag
(
int
s
ubtype
,
int
recvrank
,
int
tag
)
{
size_t
result
=
s
endrank
|
recvrank
<<
rank
_shift
|
tag
<<
(
rank_shift
*
2
);
size_t
result
=
s
ubtype
|
recvrank
<<
subtype
_shift
|
tag
<<
(
rank_shift
*
2
);
return
result
;
return
result
;
}
}
...
@@ -164,7 +167,7 @@ static BLOCKTYPE toblocks(BLOCKTYPE nr_bytes) {
...
@@ -164,7 +167,7 @@ static BLOCKTYPE toblocks(BLOCKTYPE nr_bytes) {
*
*
* @result the number of bytes.
* @result the number of bytes.
*/
*/
static
BLOCKTYPE
tobytes
(
int
nr_blocks
)
{
return
(
nr_blocks
*
BYTESINBLOCK
);
}
static
BLOCKTYPE
tobytes
(
BLOCKTYPE
nr_blocks
)
{
return
(
nr_blocks
*
BYTESINBLOCK
);
}
/**
/**
* @brief fill a data area with given value.
* @brief fill a data area with given value.
...
@@ -364,14 +367,12 @@ static void *recv_thread(void *arg) {
...
@@ -364,14 +367,12 @@ static void *recv_thread(void *arg) {
auto
*
context
=
new
infinity
::
core
::
Context
();
auto
*
context
=
new
infinity
::
core
::
Context
();
auto
*
qpFactory
=
new
infinity
::
queues
::
QueuePairFactory
(
context
);
auto
*
qpFactory
=
new
infinity
::
queues
::
QueuePairFactory
(
context
);
/* Buffer to receive all the remote data.
XXX mystery factor of 2.
*/
/* Buffer to receive all the remote data.*/
auto
*
bufferToReadWrite
=
auto
*
bufferToReadWrite
=
new
infinity
::
memory
::
Buffer
(
context
,
2
*
tobytes
(
ranktag_sizes
[
rank
]));
new
infinity
::
memory
::
Buffer
(
context
,
tobytes
(
ranktag_sizes
[
rank
]));
infinity
::
memory
::
RegionToken
*
bufferToken
=
infinity
::
memory
::
RegionToken
*
bufferToken
=
bufferToReadWrite
->
createRegionToken
();
bufferToReadWrite
->
createRegionToken
();
// XXX need to make sure it is initialised. XXX
// Port binding.
// Port binding.
if
(
verbose
)
{
if
(
verbose
)
{
message
(
"%d binding to %d on port %d"
,
myrank
,
rank
,
BASE_PORT
+
rank
);
message
(
"%d binding to %d on port %d"
,
myrank
,
rank
,
BASE_PORT
+
rank
);
...
@@ -574,8 +575,7 @@ static size_t pick_logs() {
...
@@ -574,8 +575,7 @@ static size_t pick_logs() {
/* Setup the ranktag offsets for our receive windows. Also define the sizes
/* Setup the ranktag offsets for our receive windows. Also define the sizes
* of the windows. XXX note these are over the complete lists not the
* of the windows. XXX note these are over the complete lists not the
* separated ones, k != index of sub queues.
* separated ones, k != index of sub queues. */
* XXX need to also include subtype in ranktag XXX */
for
(
int
k
=
0
;
k
<
nr_recv
;
k
++
)
{
for
(
int
k
=
0
;
k
<
nr_recv
;
k
++
)
{
struct
mpiuse_log_entry
*
log
=
recv_queue
[
k
];
struct
mpiuse_log_entry
*
log
=
recv_queue
[
k
];
ranktag_lists
[
INDEX3
(
MAX_NR_RANKS
,
nr_ranks
,
log
->
otherrank
,
log
->
rank
,
ranktag_lists
[
INDEX3
(
MAX_NR_RANKS
,
nr_ranks
,
log
->
otherrank
,
log
->
rank
,
...
@@ -668,9 +668,10 @@ int main(int argc, char *argv[]) {
...
@@ -668,9 +668,10 @@ int main(int argc, char *argv[]) {
error
(
"The number of MPI ranks %d does not match the expected value %d"
,
error
(
"The number of MPI ranks %d does not match the expected value %d"
,
nranks
,
nr_ranks
);
nranks
,
nr_ranks
);
/* Index of most significant bit in the maximum rank
id. Assumes GCC
/* Index of most significant bit
s
in the maximum rank
and subtypes.
* intrinsic. */
*
Assumes GCC
intrinsic. */
rank_shift
=
(
sizeof
(
int
)
*
CHAR_BIT
)
-
__builtin_clz
(
nr_ranks
);
rank_shift
=
(
sizeof
(
int
)
*
CHAR_BIT
)
-
__builtin_clz
(
nr_ranks
);
subtype_shift
=
(
sizeof
(
int
)
*
CHAR_BIT
)
-
__builtin_clz
(
32
);
/* We all need to agree on a maximum count of logs, so we can exchange the
/* We all need to agree on a maximum count of logs, so we can exchange the
* offset arrays (would be ragged otherwise and difficult to exchange). */
* offset arrays (would be ragged otherwise and difficult to exchange). */
...
...
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