-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #582 from sstsimulator/devel
Automatically Merged using SST Master Branch Merger
- Loading branch information
Showing
12 changed files
with
170 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,24 +50,31 @@ Questions? Contact [email protected] | |
#define one_indent " " | ||
#define two_indent " " | ||
|
||
#if 0 | ||
#if PISCES_DEBUG_INDIVIDUAL_HISTORY | ||
#define dprintf(flag, ...) \ | ||
history_.push_back(sprockit::sprintf(__VA_ARGS__)) | ||
#else | ||
#define dprintf(flag, ...) debug_printf(flag, __VA_ARGS__) | ||
#endif | ||
|
||
#if PISCES_DETAILED_DEBUG | ||
#define pflow_arb_debug_printf_l0(format_str, ...) \ | ||
debug_printf(sprockit::dbg::pisces, \ | ||
dprintf(sprockit::dbg::pisces, \ | ||
" [arbitrator] " format_str , \ | ||
__VA_ARGS__) | ||
|
||
#define pflow_arb_debug_printf_l1(format_str, ...) \ | ||
debug_printf(sprockit::dbg::pisces, \ | ||
dprintf(sprockit::dbg::pisces, \ | ||
one_indent " [arbitrator] " format_str , \ | ||
__VA_ARGS__) | ||
|
||
#define pflow_arb_debug_printf_l2(format_str, ...) \ | ||
debug_printf(sprockit::dbg::pisces, \ | ||
dprintf(sprockit::dbg::pisces, \ | ||
two_indent " [arbitrator] " format_str , \ | ||
__VA_ARGS__) | ||
|
||
#define pflow_arb_debug_print_l2(format_str) \ | ||
debug_printf(sprockit::dbg::pisces, \ | ||
dprintf(sprockit::dbg::pisces, \ | ||
two_indent " [arbitrator] " format_str "%s", "") | ||
#else | ||
#define pflow_arb_debug_printf_l0(format_str, ...) | ||
|
@@ -188,6 +195,10 @@ PiscesCutThroughArbitrator::clearOut(Timestamp now) | |
cut_through_epoch_debug("clearing at %9.5e", now.sec()); | ||
Timestamp end = epoch->start + epoch->numCycles * cycleLength_; | ||
if (now <= epoch->start){ | ||
if (!epoch->next){ | ||
//this is the last epoch, restore it to full size | ||
epoch->numCycles = std::numeric_limits<uint32_t>::max(); | ||
} | ||
return; | ||
} else if (now < end){ | ||
if (epoch->next){ | ||
|
@@ -205,6 +216,16 @@ PiscesCutThroughArbitrator::clearOut(Timestamp now) | |
Epoch* next = epoch->next; | ||
delete epoch; | ||
head_ = next; | ||
#if SSTMAC_SANITY_CHECK | ||
if (head_ == nullptr){ | ||
#if PISCES_DEBUG_INDIVIDUAL_HISTORY | ||
for (auto& str : history_){ | ||
std::cerr << str << std::endl; | ||
} | ||
#endif | ||
spkt_abort_printf("internal error: head epoch is null in PiscesCutThroughArbitrator"); | ||
} | ||
#endif | ||
epoch = next; | ||
} else { | ||
//this is the last epoch - restore it to "full size" | ||
|
@@ -223,6 +244,16 @@ PiscesCutThroughArbitrator::advance(Epoch* epoch, Epoch* prev) | |
if (prev) prev->next = epoch->next; | ||
else head_ = next; | ||
delete epoch; | ||
#if SSTMAC_SANITY_CHECK | ||
if (head_ == nullptr){ | ||
#if PISCES_DEBUG_INDIVIDUAL_HISTORY | ||
for (auto& str : history_){ | ||
std::cerr << str << std::endl; | ||
} | ||
#endif | ||
spkt_abort_printf("internal error: head epoch is null in PiscesCutThroughArbitrator"); | ||
} | ||
#endif | ||
return next; | ||
} | ||
|
||
|
@@ -232,7 +263,7 @@ PiscesCutThroughArbitrator::arbitrate(IncomingPacket &st) | |
pflow_arb_debug_printf_l0("Cut-through: arbitrator %p starting packet %p:%llu of size %u with byte_delay=%9.5e epoch_delay=%9.5e start=%9.5e: %s", | ||
this, st.pkt, st.pkt->flowId(), st.pkt->numBytes(), st.pkt->byteDelay().sec(), | ||
byteDelay_.sec(), st.now.sec(), | ||
(st.pkt->orig() ? sprockit::toString(st.pkt->orig()).c_str() : "null payload")); | ||
(st.pkt->flow() ? sprockit::toString(st.pkt->flow()).c_str() : "null payload")); | ||
|
||
#define PRINT_EPOCHS 0 | ||
#if PRINT_EPOCHS | ||
|
@@ -257,6 +288,11 @@ PiscesCutThroughArbitrator::arbitrate(IncomingPacket &st) | |
while (bytesLeft > 2){ //we often end up with 1,2 byte stragglers - ignore them for efficiency | ||
#if SSTMAC_SANITY_CHECK | ||
if (!epoch){ | ||
#if PISCES_DEBUG_INDIVIDUAL_HISTORY | ||
for (auto& str : history_){ | ||
std::cerr << str << std::endl; | ||
} | ||
#endif | ||
spkt_abort_printf("ran out of epochs on arbitrator %p: this should not be possible", this); | ||
} | ||
#endif | ||
|
@@ -265,7 +301,7 @@ PiscesCutThroughArbitrator::arbitrate(IncomingPacket &st) | |
if (st.pkt->byteDelay() <= cycleLength_){ | ||
//every cycle gets used, arriving faster than leaving | ||
if (epoch->numCycles <= bytesLeft){ | ||
cut_through_arb_debug_noargs("used all cycles") | ||
cut_through_arb_debug_noargs("used all cycles"); | ||
//epoch is completely busy | ||
bytesSent += epoch->numCycles; | ||
bytesLeft -= epoch->numCycles; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,9 @@ Questions? Contact [email protected] | |
#include <sprockit/factory.h> | ||
#include <sstmac/hardware/noise/noise.h> | ||
|
||
#define PISCES_DEBUG_INDIVIDUAL_HISTORY 0 | ||
#define PISCES_DETAILED_DEBUG 0 | ||
|
||
namespace sstmac { | ||
namespace hw { | ||
|
||
|
@@ -99,6 +102,9 @@ class PiscesBandwidthArbitrator | |
|
||
protected: | ||
TimeDelta byteDelay_; | ||
#if PISCES_DEBUG_INDIVIDUAL_HISTORY | ||
std::vector<std::string> history_; | ||
#endif | ||
|
||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
Copyright 2009-2020 National Technology and Engineering Solutions of Sandia, | ||
LLC (NTESS). Under the terms of Contract DE-NA-0003525, the U.S. Government | ||
retains certain rights in this software. | ||
Sandia National Laboratories is a multimission laboratory managed and operated | ||
by National Technology and Engineering Solutions of Sandia, LLC., a wholly | ||
owned subsidiary of Honeywell International, Inc., for the U.S. Department of | ||
Energy's National Nuclear Security Administration under contract DE-NA0003525. | ||
Copyright (c) 2009-2020, NTESS | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
Questions? Contact [email protected] | ||
*/ | ||
|
||
int fxn() | ||
{ | ||
int i=0; | ||
int mul = 0; | ||
double* x = new double[10]; | ||
int* idx = new int[5]; | ||
#pragma sst memory 10 | ||
#pragma sst compute | ||
for (i=0; i < 5; ++i){ | ||
mul *= i; | ||
for (int j=0; j < 10; ++j){ | ||
mul += (j-1); | ||
x[j] += i; | ||
mul -= x[j]; | ||
j=7; | ||
mul += x[j]; | ||
mul *= x[idx[i]]; | ||
idx[i] -= 3; | ||
mul *= x[idx[i]]; | ||
} | ||
} | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/reference/test_clang_pragma_sst_multi_pragma_cpp.ref-out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
int fxn() | ||
{ | ||
int i=0; | ||
int mul = 0; | ||
double* x = new double[10]; | ||
int* idx = new int[5]; | ||
|
||
|
||
{ uint64_t flops=0; uint64_t readBytes=0; uint64_t writeBytes=0; uint64_t intops=0; { uint64_t tripCount0=(((5)-(0))); intops += tripCount0*1;{ uint64_t tripCount1=tripCount0*(((10)-(0))); flops += tripCount1*1; readBytes += tripCount1*36; writeBytes += tripCount1*12; intops += tripCount1*16;}}readBytes=10;sstmac_compute_detailed(flops,intops,readBytes); } | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
return 0; | ||
} | ||
#include <sstmac/software/process/cppglobal.h> | ||
#include <sstmac/software/process/memoize.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ void fxn3() | |
int x = 42; | ||
|
||
|
||
|
||
for (int i=0; i < 3; ++i){ | ||
int x = 10; | ||
int z = 42; | ||
|