Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
codes
workloads
Commits
f6cf0fe9
Commit
f6cf0fe9
authored
Apr 16, 2018
by
Malek Musleh
Browse files
updates to nearest neighbor to get it to compile
parent
42ced80a
Changes
2
Hide whitespace changes
Inline
Side-by-side
swm/src/nearest_neighbor/nearest_neighbor_swm_user_code.cpp
View file @
f6cf0fe9
...
...
@@ -26,6 +26,7 @@ NearestNeighborSWMUserCode::NearestNeighborSWMUserCode(
noop_cnt
(
cfg
.
get
<
uint32_t
>
(
"jobs.noop_cnt"
,
1
)),
compute_delay
(
cfg
.
get
<
uint32_t
>
(
"jobs.compute_delay"
,
1
)),
dimension_cnt
(
cfg
.
get
<
uint32_t
>
(
"dimension_cnt"
,
0
)),
msg_size
(
cfg
.
get
<
uint32_t
>
(
"msg_size"
,
0
)),
dimension_sizes
(
boost_ptree_array_to_std_vector
<
uint32_t
>
(
cfg
,
"dimension_sizes"
,
{
0
})),
max_dimension_distance
(
cfg
.
get
<
uint32_t
>
(
"max_dimension_distance"
,
0
)),
synchronous
(
cfg
.
get
<
bool
>
(
"synchronous"
,
false
)),
...
...
@@ -44,6 +45,8 @@ NearestNeighborSWMUserCode::NearestNeighborSWMUserCode(
std
::
cout
<<
"dim_product is "
<<
dim_product
<<
" and process_cnt is "
<<
process_cnt
<<
std
::
endl
;
assert
(
dim_product
==
process_cnt
);
req_rt
=
AUTOMATIC
;
rsp_rt
=
AUTOMATIC
;
}
...
...
@@ -289,6 +292,8 @@ NearestNeighborSWMUserCode::call()
uint32_t
iter_before_sync
=
0
;
uint32_t
neighbors_size
=
neighbors
.
size
();
uint32_t
pkt_rsp_bytes
=
0
;
for
(
uint32_t
iter
=
0
;
iter
<
iteration_cnt
;
iter
++
)
{
...
...
@@ -313,29 +318,30 @@ NearestNeighborSWMUserCode::call()
//send/recv pair that we'll later wait on
SWM_Isend
(
st
d
::
get
<
0
>
(
neighbors
[
neighbor_idx
]),
boo
st
::
get
<
0
>
(
neighbors
[
neighbor_idx
]),
SWM_COMM_WORLD
,
process_id
,
0
,
// MM additions
1
,
// MM additions
NO_BUFFER
,
msg_desc
.
msg_req_bytes
,
msg_desc
.
pkt_rsp_bytes
,
msg_size
,
//
msg_desc.msg_req_bytes,
pkt_rsp_bytes
,
//
msg_desc.pkt_rsp_bytes,
&
(
send_handles
[
neighbor_idx
+
iter_before_sync
*
neighbors_size
]),
0
,
0
);
SWM_Irecv
(
st
d
::
get
<
0
>
(
neighbors
[
neighbor_idx
]),
boo
st
::
get
<
0
>
(
neighbors
[
neighbor_idx
]),
SWM_COMM_WORLD
,
st
d
::
get
<
0
>
(
neighbors
[
neighbor_idx
]),
boo
st
::
get
<
0
>
(
neighbors
[
neighbor_idx
]),
NO_BUFFER
,
&
(
recv_handles
[
neighbor_idx
+
iter_before_sync
*
neighbors_size
])
);
for
(
uint32_t
noop
=
0
;
noop
<
noop_cnt
;
noop
++
)
{
SWM_Noop
();
assert
(
0
);
// Does CODES have an equivalent of a NOOP?
//SWM_Noop();
}
}
...
...
@@ -343,20 +349,22 @@ NearestNeighborSWMUserCode::call()
{
//fire and forget
// purposes of the paper lets just use Isend/Irecv
assert
(
0
);
/*
SWM_Synthetic(
std::get<0>(neighbors[neighbor_idx]), //dst
0,
0,
0,
msg_desc
.
msg_req_bytes
,
msg_desc
.
msg_rsp_bytes
,
msg_desc
.
pkt_rsp_bytes
,
msg_desc
.
msg_req_routing_type
,
msg_desc
.
msg_rsp_routing_type
,
msg_desc
.
pkt_rsp_routing_type
,
msg_size, //
msg_desc.msg_req_bytes,
0, //
msg_desc.msg_rsp_bytes,
pkt_rsp_bytes, //
msg_desc.pkt_rsp_bytes,
req_rt, //
msg_desc.msg_req_routing_type,
rsp_rt, //
msg_desc.msg_rsp_routing_type,
rsp_rt, //
msg_desc.pkt_rsp_routing_type,
NULL,
msg_desc
.
attribute
NULL, //
msg_desc.attribute
#ifdef FABSIM_EMULATION
, msg_desc.l2_encoding
#endif
...
...
@@ -366,6 +374,8 @@ NearestNeighborSWMUserCode::call()
SWM_Noop();
}
*/
}
}
...
...
swm/src/nearest_neighbor/nearest_neighbor_swm_user_code.h
View file @
f6cf0fe9
...
...
@@ -22,17 +22,22 @@
#include
<boost/property_tree/ptree.hpp>
#include
<boost/tuple/tuple.hpp>
#include
<boost/tuple/tuple_comparison.hpp>
#include
<string>
#include
<iostream>
#include
<random>
#include
<algorithm>
#include
<vector>
#include
<regex>
#include
"swm-include.h"
using
namespace
std
;
typedef
boost
::
tuple
<
uint32_t
,
std
::
string
>
neighbor_tuple
;
typedef
uint32_t
RoutingType
;
/*
struct neighbor {
std::string neighbor_name; //this will be of the form ([+,-]([0-9]+))+, for example +x-y+z is +0-1+2 and +x-z is +0-2
...
...
@@ -40,6 +45,63 @@ struct neighbor {
};
*/
// MM: This msg traffic code is part of the base swm class
typedef
struct
msg_traffic_desc
{
//SWMMessageAttribute attribute;
RoutingType
msg_req_routing_type
;
RoutingType
msg_rsp_routing_type
;
RoutingType
pkt_rsp_routing_type
;
std
::
vector
<
uint32_t
>
msg_req_bytess
;
std
::
vector
<
uint32_t
>
msg_rsp_bytess
;
std
::
vector
<
uint32_t
>
pkt_rsp_bytess
;
uint32_t
msg_req_bytes
;
uint32_t
msg_rsp_bytes
;
uint32_t
pkt_rsp_bytes
;
std
::
vector
<
uint32_t
>
msg_req_vcs
;
std
::
vector
<
uint32_t
>
msg_rsp_vcs
;
std
::
vector
<
uint32_t
>
pkt_rsp_vcs
;
uint32_t
msg_req_vc
;
uint32_t
msg_rsp_vc
;
uint32_t
pkt_rsp_vc
;
/*
#ifdef FABSIM_EMULATION
stl_l2_encoding l2_encoding;
std::vector<uint32_t> dlid_xors;
uint32_t dlid_xor;
#endif
*/
}
msg_traffic_desc
;
struct
msg_traffic_set
{
std
::
vector
<
std
::
tuple
<
uint32_t
,
msg_traffic_desc
>
>
set
;
uint32_t
msg_parts_sum
;
std
::
string
name
;
std
::
string
regex_string
;
public:
msg_traffic_set
(
std
::
string
name
,
std
::
string
regex_string
)
:
msg_parts_sum
(
0
),
name
(
name
),
regex_string
(
regex_string
)
{}
};
std
::
vector
<
msg_traffic_set
*>
msg_traffic_def_vector
;
// MM addition: normally part of base class
class
NearestNeighborSWMUserCode
{
...
...
@@ -72,8 +134,11 @@ protected:
uint32_t
iteration_cnt
;
//MM addition
uint32_t
noop_cnt
;
//MM addition
uint32_t
compute_delay
;
//MM addition
uint32_t
msg_size
;
// MM addition
int
process_id
;
//MM addition
int
req_rt
;
// MM addition
int
rsp_rt
;
// MM addition
uint32_t
dimension_cnt
;
std
::
vector
<
uint32_t
>
dimension_sizes
;
uint32_t
max_dimension_distance
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment