Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sst/elements/mercury/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ libhg_la_SOURCES = \
common/util.cc \
common/timestamp.cc \
common/connection.cc \
common/skeleton.cc \
components/compute_library/node_cl.cc \
components/compute_library/operating_system_cl.cc \
components/compute_library/operating_system_cl_api.cc \
Expand Down
55 changes: 55 additions & 0 deletions src/sst/elements/mercury/common/skeleton.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2009-2025 NTESS. Under the terms
// of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Copyright (c) 2009-2025, NTESS
// All rights reserved.
//
// Portions are copyright of other developers:
// See the file CONTRIBUTORS.TXT in the top level directory
// of the distribution for more information.
//
// This file is part of the SST software package. For license
// information, see the LICENSE file in the top level directory of the
// distribution.

//#include <mercury/common/skeleton.h>
#include <mercury/common/timestamp.h>
#include <mercury/operating_system/libraries/unblock_event.h>
#include <mercury/components/operating_system_api.h>
#include <mercury/components/operating_system_impl.h>

namespace SST::Hg {

unsigned int
ssthg_sleep(unsigned int secs) {
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
Thread* t = cos->activeThread();
UnblockEvent* ev = new UnblockEvent(cos, t);
cos->sendDelayedExecutionEvent(TimeDelta(secs, TimeDelta::one_second), ev);
cos->block();
return 0;
}

unsigned int
ssthg_usleep(unsigned int usecs) {
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
Thread* t = cos->activeThread();
UnblockEvent* ev = new UnblockEvent(cos, t);
cos->sendDelayedExecutionEvent(TimeDelta(usecs, TimeDelta::one_microsecond), ev);
cos->block();
return 0;
}

unsigned int
ssthg_nanosleep(unsigned int nsecs) {
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
Thread* t = cos->activeThread();
UnblockEvent* ev = new UnblockEvent(cos, t);
cos->sendDelayedExecutionEvent(TimeDelta(nsecs, TimeDelta::one_nanosecond), ev);
cos->block();
return 0;
}

} //end namespace SST::Hg

36 changes: 3 additions & 33 deletions src/sst/elements/mercury/common/skeleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

#pragma once

#include <mercury/operating_system/libraries/unblock_event.h>
#include <mercury/components/operating_system_api.h>
#include <mercury/components/operating_system_impl.h>

#define SSTPP_QUOTE(name) #name
#define SSTPP_STR(name) SSTPP_QUOTE(name)

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

namespace SST::Hg {

unsigned int
ssthg_sleep(unsigned int secs) {
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
Thread* t = cos->activeThread();
UnblockEvent* ev = new UnblockEvent(cos, t);
cos->sendDelayedExecutionEvent(TimeDelta(secs, TimeDelta::one_second), ev);
cos->block();
return 0;
}

unsigned int
ssthg_usleep(unsigned int usecs) {
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
Thread* t = cos->activeThread();
UnblockEvent* ev = new UnblockEvent(cos, t);
cos->sendDelayedExecutionEvent(TimeDelta(usecs, TimeDelta::one_microsecond), ev);
cos->block();
return 0;
}

unsigned int
ssthg_nanosleep(unsigned int nsecs) {
OperatingSystemAPI* cos = OperatingSystemImpl::currentOs();
Thread* t = cos->activeThread();
UnblockEvent* ev = new UnblockEvent(cos, t);
cos->sendDelayedExecutionEvent(TimeDelta(nsecs, TimeDelta::one_nanosecond), ev);
cos->block();
return 0;
}
unsigned int ssthg_sleep(unsigned int secs);
unsigned int ssthg_usleep(unsigned int usecs);
unsigned int ssthg_nanosleep(unsigned int nsecs);

} //end namespace SST::Hg

Expand Down
Loading