Skip to content

Commit d588d11

Browse files
authored
Merge pull request #2615 from nab880/devel
Seperated sleep calls into skeleton.cc file instead of included in sk…
2 parents c2b8674 + 72b5975 commit d588d11

File tree

4 files changed

+61
-33
lines changed

4 files changed

+61
-33
lines changed

src/sst/elements/mask-mpi/skeletons/halo3d-26.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Questions? Contact [email protected]
4444

4545
#include <mask_mpi.h>
4646
#include <mercury/common/skeleton.h>
47+
#include <cstdlib>
48+
#include <ctime>
4749
//#include <sstmac/replacements/sys/time.h>
4850
//#include <sstmac/replacements/time.h>
4951

src/sst/elements/mercury/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ libhg_la_SOURCES = \
2525
common/util.cc \
2626
common/timestamp.cc \
2727
common/connection.cc \
28+
common/skeleton.cc \
2829
components/compute_library/node_cl.cc \
2930
components/compute_library/operating_system_cl.cc \
3031
components/compute_library/operating_system_cl_api.cc \
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2009-2025 NTESS. Under the terms
2+
// of Contract DE-NA0003525 with NTESS, the U.S.
3+
// Government retains certain rights in this software.
4+
//
5+
// Copyright (c) 2009-2025, NTESS
6+
// All rights reserved.
7+
//
8+
// Portions are copyright of other developers:
9+
// See the file CONTRIBUTORS.TXT in the top level directory
10+
// of the distribution for more information.
11+
//
12+
// This file is part of the SST software package. For license
13+
// information, see the LICENSE file in the top level directory of the
14+
// distribution.
15+
16+
//#include <mercury/common/skeleton.h>
17+
#include <mercury/common/timestamp.h>
18+
#include <mercury/operating_system/libraries/unblock_event.h>
19+
#include <mercury/components/operating_system_api.h>
20+
#include <mercury/components/operating_system_impl.h>
21+
22+
namespace SST::Hg {
23+
24+
unsigned int
25+
ssthg_sleep(unsigned int secs) {
26+
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
27+
Thread* t = cos->activeThread();
28+
UnblockEvent* ev = new UnblockEvent(cos, t);
29+
cos->sendDelayedExecutionEvent(TimeDelta(secs, TimeDelta::one_second), ev);
30+
cos->block();
31+
return 0;
32+
}
33+
34+
unsigned int
35+
ssthg_usleep(unsigned int usecs) {
36+
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
37+
Thread* t = cos->activeThread();
38+
UnblockEvent* ev = new UnblockEvent(cos, t);
39+
cos->sendDelayedExecutionEvent(TimeDelta(usecs, TimeDelta::one_microsecond), ev);
40+
cos->block();
41+
return 0;
42+
}
43+
44+
unsigned int
45+
ssthg_nanosleep(unsigned int nsecs) {
46+
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
47+
Thread* t = cos->activeThread();
48+
UnblockEvent* ev = new UnblockEvent(cos, t);
49+
cos->sendDelayedExecutionEvent(TimeDelta(nsecs, TimeDelta::one_nanosecond), ev);
50+
cos->block();
51+
return 0;
52+
}
53+
54+
} //end namespace SST::Hg
55+

src/sst/elements/mercury/common/skeleton.h

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818

1919
#pragma once
2020

21-
#include <mercury/operating_system/libraries/unblock_event.h>
22-
#include <mercury/components/operating_system_api.h>
23-
#include <mercury/components/operating_system_impl.h>
24-
2521
#define SSTPP_QUOTE(name) #name
2622
#define SSTPP_STR(name) SSTPP_QUOTE(name)
2723

@@ -84,35 +80,9 @@ void sst_hg_blocking_call(int condition, double timeout, const char* api);
8480

8581
namespace SST::Hg {
8682

87-
unsigned int
88-
ssthg_sleep(unsigned int secs) {
89-
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
90-
Thread* t = cos->activeThread();
91-
UnblockEvent* ev = new UnblockEvent(cos, t);
92-
cos->sendDelayedExecutionEvent(TimeDelta(secs, TimeDelta::one_second), ev);
93-
cos->block();
94-
return 0;
95-
}
96-
97-
unsigned int
98-
ssthg_usleep(unsigned int usecs) {
99-
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
100-
Thread* t = cos->activeThread();
101-
UnblockEvent* ev = new UnblockEvent(cos, t);
102-
cos->sendDelayedExecutionEvent(TimeDelta(usecs, TimeDelta::one_microsecond), ev);
103-
cos->block();
104-
return 0;
105-
}
106-
107-
unsigned int
108-
ssthg_nanosleep(unsigned int nsecs) {
109-
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
110-
Thread* t = cos->activeThread();
111-
UnblockEvent* ev = new UnblockEvent(cos, t);
112-
cos->sendDelayedExecutionEvent(TimeDelta(nsecs, TimeDelta::one_nanosecond), ev);
113-
cos->block();
114-
return 0;
115-
}
83+
unsigned int ssthg_sleep(unsigned int secs);
84+
unsigned int ssthg_usleep(unsigned int usecs);
85+
unsigned int ssthg_nanosleep(unsigned int nsecs);
11686

11787
} //end namespace SST::Hg
11888

0 commit comments

Comments
 (0)