From f06e437de9642005530bb668ed72fa2699437464 Mon Sep 17 00:00:00 2001 From: jpkenny Date: Thu, 7 Nov 2024 15:17:14 -0800 Subject: [PATCH 1/2] Mercury: major code cleanup and debugging improvements --- .../tests/platform_file_mask_mpi_test.py | 9 +- .../elements/mask-mpi/tests/test_sendrecv.py | 1 - .../tests/testsuite_default_mask_mpi.py | 10 +- src/sst/elements/mercury/common/connection.cc | 57 +--- src/sst/elements/mercury/common/connection.h | 57 +--- .../elements/mercury/common/connection_fwd.h | 62 ++--- .../elements/mercury/common/event_handler.h | 57 +--- src/sst/elements/mercury/common/event_link.cc | 57 +--- src/sst/elements/mercury/common/event_link.h | 57 +--- src/sst/elements/mercury/common/events_fwd.h | 57 +--- src/sst/elements/mercury/common/skeleton.h | 3 + src/sst/elements/mercury/common/stl_string.h | 57 +--- .../elements/mercury/common/thread_safe_new.h | 1 - .../mercury/common/unusedvariablemacro.h | 57 +--- src/sst/elements/mercury/common/util.cc | 90 ------ src/sst/elements/mercury/common/util.h | 16 -- src/sst/elements/mercury/components/nic.cc | 255 ++++------------- src/sst/elements/mercury/components/nic.h | 163 ++--------- src/sst/elements/mercury/components/nic_fwd.h | 57 +--- src/sst/elements/mercury/components/node.cc | 3 +- src/sst/elements/mercury/components/node.h | 2 + .../mercury/components/operating_system.cc | 256 +++++++++--------- .../mercury/components/operating_system.h | 12 +- .../mercury/components/operating_system_fwd.h | 9 +- .../elements/mercury/hardware/common/packet.h | 1 - .../mercury/hardware/common/recv_cq.cc | 3 +- .../mercury/libraries/compute/compute_event.h | 8 +- .../libraries/compute/compute_event_fwd.h | 6 +- .../mercury/libraries/compute/lib_compute.cc | 4 +- .../mercury/libraries/compute/lib_compute.h | 4 +- .../libraries/compute/lib_compute_inst.cc | 6 - .../libraries/compute/lib_compute_inst.h | 5 - .../libraries/compute/lib_compute_memmove.cc | 9 +- .../libraries/compute/lib_compute_memmove.h | 4 +- .../libraries/compute/lib_compute_time.cc | 5 +- .../libraries/compute/lib_compute_time.h | 4 +- .../libraries/compute/lib_hybrid_compute.h | 4 +- .../operating_system/launch/app_launcher.cc | 61 +---- .../mercury/operating_system/libraries/api.cc | 10 - .../mercury/operating_system/libraries/api.h | 1 - .../mercury/operating_system/process/app.cc | 158 +---------- .../mercury/operating_system/process/app.h | 17 -- .../process/compute_scheduler.cc | 2 - .../process/compute_scheduler.h | 4 - .../operating_system/process/loadlib.cc | 2 - .../process/progress_queue.cc | 60 ++-- .../operating_system/process/progress_queue.h | 61 ++--- .../process/simple_compute_scheduler.cc | 1 - .../operating_system/process/thread.cc | 200 -------------- .../mercury/operating_system/process/thread.h | 75 ----- .../operating_system/process/thread_info.cc | 4 - src/sst/elements/mercury/pymercury.py | 23 +- 52 files changed, 441 insertions(+), 1706 deletions(-) diff --git a/src/sst/elements/mask-mpi/tests/platform_file_mask_mpi_test.py b/src/sst/elements/mask-mpi/tests/platform_file_mask_mpi_test.py index 8087d52bd5..5c40c597d7 100644 --- a/src/sst/elements/mask-mpi/tests/platform_file_mask_mpi_test.py +++ b/src/sst/elements/mask-mpi/tests/platform_file_mask_mpi_test.py @@ -4,6 +4,14 @@ platdef = PlatformDefinition("platform_mask_mpi_test") PlatformDefinition.registerPlatformDefinition(platdef) +platdef.addParamSet("node",{ + "verbose" : "0", +}) + +platdef.addParamSet("nic",{ + "verbose" : "0", +}) + platdef.addParamSet("operating_system",{ "verbose" : "0", }) @@ -19,7 +27,6 @@ "output_buf_size" : "16kB" }) -#platdef.addClassType("network_interface","sst.merlin.interface.LinkControl") platdef.addClassType("network_interface","sst.merlin.interface.ReorderLinkControl") platdef.addParamSet("router",{ diff --git a/src/sst/elements/mask-mpi/tests/test_sendrecv.py b/src/sst/elements/mask-mpi/tests/test_sendrecv.py index 4e0f428b98..c39d5251d9 100644 --- a/src/sst/elements/mask-mpi/tests/test_sendrecv.py +++ b/src/sst/elements/mask-mpi/tests/test_sendrecv.py @@ -25,7 +25,6 @@ platform = PlatformDefinition.getCurrentPlatform() platform.addParamSet("operating_system", { - "verbose" : "0", "app1.name" : "sendrecv", "app1.exe" : "sendrecv.so", "app1.apis" : ["systemAPI:libsystemapi.so", "SimTransport:libsumi.so", "MpiApi:libmask_mpi.so"], diff --git a/src/sst/elements/mask-mpi/tests/testsuite_default_mask_mpi.py b/src/sst/elements/mask-mpi/tests/testsuite_default_mask_mpi.py index b3c9c0c14e..f7773c95a6 100644 --- a/src/sst/elements/mask-mpi/tests/testsuite_default_mask_mpi.py +++ b/src/sst/elements/mask-mpi/tests/testsuite_default_mask_mpi.py @@ -22,7 +22,7 @@ def tearDown(self): def test_sendrecv(self): testdir = self.get_testsuite_dir() - libdir = sstsimulator_conf_get_value_str("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR") + libdir = sstsimulator_conf_get_value("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR",str) path = os.environ.get("SST_LIB_PATH") if path is None or path == "": os.environ["SST_LIB_PATH"] = libdir @@ -32,7 +32,7 @@ def test_sendrecv(self): def test_reduce(self): testdir = self.get_testsuite_dir() - libdir = sstsimulator_conf_get_value_str("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR") + libdir = sstsimulator_conf_get_value("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR",str) path = os.environ.get("SST_LIB_PATH") if path is None or path == "": os.environ["SST_LIB_PATH"] = libdir @@ -42,7 +42,7 @@ def test_reduce(self): def test_alltoall(self): testdir = self.get_testsuite_dir() - libdir = sstsimulator_conf_get_value_str("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR") + libdir = sstsimulator_conf_get_value("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR",str) path = os.environ.get("SST_LIB_PATH") if path is None or path == "": os.environ["SST_LIB_PATH"] = libdir @@ -52,7 +52,7 @@ def test_alltoall(self): def test_allgather(self): testdir = self.get_testsuite_dir() - libdir = sstsimulator_conf_get_value_str("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR") + libdir = sstsimulator_conf_get_value("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR",str) path = os.environ.get("SST_LIB_PATH") if path is None or path == "": os.environ["SST_LIB_PATH"] = libdir @@ -62,7 +62,7 @@ def test_allgather(self): def test_halo3d26(self): testdir = self.get_testsuite_dir() - libdir = sstsimulator_conf_get_value_str("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR") + libdir = sstsimulator_conf_get_value("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR",str) path = os.environ.get("SST_LIB_PATH") if path is None or path == "": os.environ["SST_LIB_PATH"] = libdir diff --git a/src/sst/elements/mercury/common/connection.cc b/src/sst/elements/mercury/common/connection.cc index 4e51c5348b..d3fea34e44 100644 --- a/src/sst/elements/mercury/common/connection.cc +++ b/src/sst/elements/mercury/common/connection.cc @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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 #include diff --git a/src/sst/elements/mercury/common/connection.h b/src/sst/elements/mercury/common/connection.h index 692be7b760..a1cd371bc2 100644 --- a/src/sst/elements/mercury/common/connection.h +++ b/src/sst/elements/mercury/common/connection.h @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once diff --git a/src/sst/elements/mercury/common/connection_fwd.h b/src/sst/elements/mercury/common/connection_fwd.h index f2cf4b0245..9d0fcba4af 100644 --- a/src/sst/elements/mercury/common/connection_fwd.h +++ b/src/sst/elements/mercury/common/connection_fwd.h @@ -1,49 +1,19 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ - -#ifndef CONNECTION_FWD_H -#define CONNECTION_FWD_H +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. + +#pragma once namespace SST { namespace Hg { diff --git a/src/sst/elements/mercury/common/event_handler.h b/src/sst/elements/mercury/common/event_handler.h index e88e5e3aeb..3fb82e5c38 100644 --- a/src/sst/elements/mercury/common/event_handler.h +++ b/src/sst/elements/mercury/common/event_handler.h @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once diff --git a/src/sst/elements/mercury/common/event_link.cc b/src/sst/elements/mercury/common/event_link.cc index ff204e8071..68c4b0d428 100644 --- a/src/sst/elements/mercury/common/event_link.cc +++ b/src/sst/elements/mercury/common/event_link.cc @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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 diff --git a/src/sst/elements/mercury/common/event_link.h b/src/sst/elements/mercury/common/event_link.h index 7a350e236c..8652aa013e 100644 --- a/src/sst/elements/mercury/common/event_link.h +++ b/src/sst/elements/mercury/common/event_link.h @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once diff --git a/src/sst/elements/mercury/common/events_fwd.h b/src/sst/elements/mercury/common/events_fwd.h index 49be0eba29..6a744aa7b3 100644 --- a/src/sst/elements/mercury/common/events_fwd.h +++ b/src/sst/elements/mercury/common/events_fwd.h @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once diff --git a/src/sst/elements/mercury/common/skeleton.h b/src/sst/elements/mercury/common/skeleton.h index 8ddd2bbfc3..db2e6630e6 100644 --- a/src/sst/elements/mercury/common/skeleton.h +++ b/src/sst/elements/mercury/common/skeleton.h @@ -13,6 +13,9 @@ // information, see the LICENSE file in the top level directory of the // distribution. +// There's a reasonable chance that we'll want the globals/TLS support eventually, +// so I'm leaving that sst-macro code here for now -- JPK + #pragma once #define SSTPP_QUOTE(name) #name diff --git a/src/sst/elements/mercury/common/stl_string.h b/src/sst/elements/mercury/common/stl_string.h index 401158ace8..a39f740759 100644 --- a/src/sst/elements/mercury/common/stl_string.h +++ b/src/sst/elements/mercury/common/stl_string.h @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once diff --git a/src/sst/elements/mercury/common/thread_safe_new.h b/src/sst/elements/mercury/common/thread_safe_new.h index 312a46c168..3da5d4d278 100644 --- a/src/sst/elements/mercury/common/thread_safe_new.h +++ b/src/sst/elements/mercury/common/thread_safe_new.h @@ -15,7 +15,6 @@ #pragma once -//#include #include #include diff --git a/src/sst/elements/mercury/common/unusedvariablemacro.h b/src/sst/elements/mercury/common/unusedvariablemacro.h index 32e1a611c1..3c56f4a881 100644 --- a/src/sst/elements/mercury/common/unusedvariablemacro.h +++ b/src/sst/elements/mercury/common/unusedvariablemacro.h @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once diff --git a/src/sst/elements/mercury/common/util.cc b/src/sst/elements/mercury/common/util.cc index fe778f6fea..de14aa31b2 100644 --- a/src/sst/elements/mercury/common/util.cc +++ b/src/sst/elements/mercury/common/util.cc @@ -16,7 +16,6 @@ #include #include #include -//#include #include @@ -26,52 +25,6 @@ extern template class SST::Hg::HgBase; typedef int (*main_fxn)(int,char**); typedef int (*empty_main_fxn)(); -//extern "C" double -//sst_hg_now(){ -// return sstmac::sw::OperatingSystem::currentOs()->now().sec(); -//} - -//extern "C" void -//sst_hg_sleep_precise(double secs){ -// sstmac::sw::OperatingSystem::currentOs()->sleep(sstmac::TimeDelta(secs)); -//} - -// namespace sstmac { - -//SST::Params& appParams(){ -// return sstmac::sw::OperatingSystem::currentThread()->parentApp()->params(); -//} - -//std::string getAppParam(const std::string& name){ -// return appParams().find(name); -//} - -//bool appHasParam(const std::string& name){ -// return appParams().contains(name); -//} - -//void getAppUnitParam(const std::string& name, double& val){ -// val = appParams().find(name).getValue().toDouble(); -//} - -//void getAppUnitParam(const std::string& name, int& val){ -// val = appParams().find(name).getRoundedValue(); -//} - -//void getAppUnitParam(const std::string& name, const std::string& def, int& val){ -// val = appParams().find(name, def).getRoundedValue(); -//} - -//void getAppUnitParam(const std::string& name, const std::string& def, double& val){ -// val = appParams().find(name, def).getRoundedValue(); -//} - -//void getAppArrayParam(const std::string& name, std::vector& vec){ -// appParams().find_array(name, vec); -//} - -//} // end namespace sstmac - extern "C" void ssthg_exit(int code) { SST::Hg::OperatingSystem::currentThread()->kill(code); @@ -96,51 +49,8 @@ extern "C" int ssthg_atexit(void (* /*fxn*/)(void)) return 0; } -//extern "C" -//int sst_hg_gethostname(char* name, size_t len) -//{ -// std::string sst_name = sstmac::sw::OperatingSystem::currentOs()->hostname(); -// if (sst_name.size() > len){ -// return -1; -// } else { -// ::strcpy(name, sst_name.c_str()); -// return 0; -// } -//} - -//extern "C" -//long sst_hg_gethostid() -//{ -// return sstmac::sw::OperatingSystem::currentOs()->addr(); -//} - -//extern "C" -//void sst_hg_free(void* ptr){ -//#ifdef free -//#error #sstmac free macro should not be defined in util.cc - refactor needed -//#endif -// if (isNonNullBuffer(ptr)) free(ptr); -//} - #include -//extern "C" -//void sst_hg_advance_time(const char* param_name) -//{ -// sstmac::sw::Thread* thr = sstmac::sw::OperatingSystem::currentThread(); -// sstmac::sw::App* parent = thr->parentApp(); -// using ValueCache = std::unordered_map; -// static std::map cache; -// auto& subMap = cache[parent->aid()]; -// auto iter = subMap.find((void*)param_name); -// if (iter == subMap.end()){ -// subMap[(void*)param_name] = -// sstmac::TimeDelta(parent->params().find(param_name).getValue().toDouble()); -// iter = subMap.find((void*)param_name); -// } -// parent->compute(iter->second); -//} - int userSkeletonMainInitFxn(const char* name, main_fxn fxn) { diff --git a/src/sst/elements/mercury/common/util.h b/src/sst/elements/mercury/common/util.h index a519912959..943591d783 100644 --- a/src/sst/elements/mercury/common/util.h +++ b/src/sst/elements/mercury/common/util.h @@ -16,24 +16,8 @@ #pragma once #ifdef __cplusplus - #include #include -//#include -//#include - -/** Automatically inherit the errors */ -//using sprockit::IllformedError; -//using sprockit::InputError; -//using sprockit::InvalidKeyError; -//using sprockit::IOError; -//using sprockit::IteratorError; -//using sprockit::LibraryError; -//using sprockit::MemoryError; -//using sprockit::NullError; -//using sprockit::OSError; -//using sprockit::RangeError; -//using sprockit::SpktError; #endif namespace SST::Hg { diff --git a/src/sst/elements/mercury/components/nic.cc b/src/sst/elements/mercury/components/nic.cc index 9e6ba23e0e..a21b8468dd 100644 --- a/src/sst/elements/mercury/components/nic.cc +++ b/src/sst/elements/mercury/components/nic.cc @@ -1,82 +1,32 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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 -//#include -#include -#include -#include -//#include -//#include -//#include -//#include -//#include -//#include #include -//#include #include +#include +#include +#include -//RegisterDebugSlot(nic); - -//RegisterNamespaces("nic", "message_sizes", "traffic_matrix", -// "message_size_histogram", "injection", "bytes"); - -//RegisterKeywords( -//{ "nic_name", "DEPRECATED: the type of NIC to use on the node" }, -//{ "network_spyplot", "DEPRECATED: the file root of all stats showing traffic matrix" }, -//{ "post_latency", "the latency of the NIC posting messages" }, -//); - -#define DEFAULT_NEGLIGIBLE_SIZE 256 +#include static std::string _tick_spacing_string_("1ps"); namespace SST { namespace Hg { -//static sprockit::NeedDeletestatics del_statics; - void NicEvent::serialize_order(serializer &ser) { @@ -86,38 +36,24 @@ NicEvent::serialize_order(serializer &ser) NIC::NIC(uint32_t id, SST::Params& params, Node* parent) : SST::Hg::SubComponent(id), -//NIC::NIC(uint32_t id, SST::Params& params, Node* parent) : -// ConnectableSubcomponent(id, "nic", parent), parent_(parent), my_addr_(parent->os()->addr()), -// logp_link_(nullptr), -// spy_bytes_(nullptr), -// xmit_flows_(nullptr), -// queue_(parent->os()), os_(parent->os()) { - negligibleSize_ = params.find("negligible_size", DEFAULT_NEGLIGIBLE_SIZE); - //top_ = Topology::staticTopology(params); - - std::string subname = SST::Hg::sprintf("NIC.%d", my_addr_); -// auto* spy = registerMultiStatistic(params, "spy_bytes", subname); -// //this might be a null statistic, dynamic cast to check -// //no calls are made to this statistic unless it is non-null -// //nullness checks are deferred to other places -// spy_bytes_ = dynamic_cast*>(spy); - -// xmit_flows_ = registerStatistic(params, "xmit_flows", subname); - - int slot_id = 0; + unsigned int verbose = params.find("verbose", 0); + out_ = std::unique_ptr( + new SST::Output(toString(), verbose, 0, Output::STDOUT)); pending_.resize(1); ack_queue_.resize(1); + + // FIXME needs to be a parameter mtu_ = 2048; } std::string NIC::toString() { - return sprintf("mercury nic(%d)", int(addr())); + return sprintf("Node%d:HgNIC:", int(addr())); } void @@ -198,31 +134,11 @@ NIC::incomingPacket(int vn){ if (flow == nullptr) sst_hg_abort_printf("couldn't get a flow\n"); auto* msg = static_cast(flow); if (msg == nullptr) sst_hg_abort_printf("couldn't cast flow to message\n"); - //printf("fully received message %s\n", msg->toString().c_str()); + out_->debug(CALL_INFO, 1, 0, "fully received message %s", + msg->toString().c_str()); recvMessage(msg); } req = link_control_->recv(vn); - - // //printf("incoming flow %d\n",req->flow_id); - // MyRequest* myreq = static_cast(req); - // auto bytes = myreq->size_in_bits/8; - // auto* payload = myreq->takePayload(); - // //MessageEvent* ev = payload ? static_cast(payload) : nullptr; - // auto* incoming_msg = payload ? static_cast(payload) : nullptr; - // //Flow* flow = cq_.recv(myreq->flow_id, bytes, ev ? ev->msg() : nullptr); - // Flow* flow = cq_.recv(myreq->flow_id, bytes, incoming_msg); - // printf("Rank %d receiving packet of size %d for flow %lu on vn %d: %s\n", - // my_addr_,(myreq->size_in_bits/8), (uint64_t) myreq->flow_id, vn, (flow ? flow->toString().c_str() : "no flow")); - // if (flow){ - // auto* msg = static_cast(flow); - // printf("fully received message %s\n", msg->toString().c_str()); - // recvMessage(msg); - // } - // delete myreq; - // //if (ev) delete ev; - // //FIXME: need to figure out ownership and who deletes what here - // //if (incoming_msg) delete incoming_msg; - // req = link_control_->recv(vn); } return true; //keep me active } @@ -251,11 +167,8 @@ NIC::payloadHandler(int /*port*/) { void NIC::inject(int vn, NetworkMessage* payload){ - if (payload->byteLength() == 0){ - //spkt_abort_printf("Got zero-sized message: %s", payload->toString().c_str()); - } pending_[vn].emplace(payload); - //nic_debug("sending message on vn %d: %s", vn, payload->toString().c_str()); + out_->debug(CALL_INFO, 1, 0, "sending message on vn %d: %s", vn, payload->toString().c_str()); sendWhatYouCan(vn); } @@ -275,18 +188,11 @@ NIC::sendWhatYouCan(int vn) { bool NIC::sendWhatYouCan(int vn, Pending& p) { - //if (!p.bytesLeft) sst_hg_abort_printf("zero send abort\n"); int seqnum = 0; uint64_t next_bytes = std::min(uint64_t(mtu_), p.bytesLeft); uint32_t next_bits = next_bytes * 8; //this is fine for 32-bits while (link_control_->spaceToSend(vn, next_bits)){ - // auto* req = new MyRequest; - // req->head = p.bytesLeft == p.payload->byteLength(); - // p.bytesLeft -= next_bytes; - // req->tail = p.bytesLeft == 0; - // req->flow_id = p.payload->flowId(); - // req->start = now(); auto* req = new SST::Interfaces::SimpleNetwork::Request; req->head = p.bytesLeft == p.payload->byteLength(); p.bytesLeft -= next_bytes; @@ -311,9 +217,9 @@ NIC::sendWhatYouCan(int vn, Pending& p) { req->size_in_bits = next_bits; req->vn = 0; - // printf("injecting request of size %" PRIu64 " on vn %d: head? %d tail? %d -> %s\n", - // next_bytes, vn, req->head, req->tail, - // p.payload->toString().c_str()); + out_->debug(CALL_INFO, 1, 0, "injecting request of size %" PRIu64 " on vn %d: head? %d tail? %d -> %s\n", + next_bytes, vn, req->head, req->tail, + p.payload->toString().c_str()); link_control_->send(req, vn); next_bytes = std::min(uint64_t(mtu_), p.bytesLeft); @@ -323,27 +229,6 @@ NIC::sendWhatYouCan(int vn, Pending& p) { return false; } -//void -//NIC::configureLogPLinks() -//{ -// initInputLink(addr(), hw::NIC::LogP); -// initOutputLink(hw::NIC::LogP, addr()); -//} - -void -NIC::configureLinks() -{ - //set up LogP management/shortcut network -// configureLogPLinks(); - -// std::vector ports; -// top_->injectionPorts(addr(), ports); -// for (Topology::InjectionPort& port : ports){ -// initOutputLink(port.ep_port, port.switch_port); -// initInputLink(port.switch_port, port.ep_port); -// } -} - NIC::~NIC() { } @@ -357,7 +242,7 @@ NIC::mtlHandler() const void NIC::mtlHandle(Event *ev) { -// nic_debug("MTL handle"); + out_->debug(CALL_INFO, 1, 0, "MTL handle"); NicEvent* nev = static_cast(ev); NetworkMessage* msg = nev->msg(); delete nev; @@ -373,7 +258,6 @@ std::function NIC::ctrlIoctl() { auto f = [=](NetworkMessage* msg){ - //this->sendManagerMsg(msg); this->injectSend(msg); }; return f; @@ -399,15 +283,14 @@ NIC::injectSend(NetworkMessage* netmsg) void NIC::recvMessage(NetworkMessage* netmsg) { - // printf("handling %s:%lu of type %s from node %d while running\n", - // netmsg->toString().c_str(), - // (unsigned long) netmsg->flowId(), - // NetworkMessage::tostr(netmsg->type()), - // int(netmsg->fromaddr())); + out_->debug(CALL_INFO, 1, 0, "handling %s:%lu of type %s from node %d while running\n", + netmsg->toString().c_str(), + (unsigned long) netmsg->flowId(), + NetworkMessage::tostr(netmsg->type()), + int(netmsg->fromaddr())); switch (netmsg->type()) { case NetworkMessage::rdma_get_request: { - // sst_hg_abort_printf("case NetworkMessage::rdma_get_request unimplemented\n"); netmsg->nicReverse(NetworkMessage::rdma_get_payload); netmsg->putOnWire(); internodeSend(netmsg); @@ -450,7 +333,8 @@ NIC::ackSend(NetworkMessage* payload) { if (payload->needsAck()){ NetworkMessage* ack = payload->cloneInjectionAck(); -// nic_debug("acking payload %s", payload->toString().c_str()); + out_->debug(CALL_INFO, 1, 0, "acking payload %s", + payload->toString().c_str()); sendToNode(ack); } } @@ -458,7 +342,8 @@ NIC::ackSend(NetworkMessage* payload) void NIC::intranodeSend(NetworkMessage* payload) { -// nic_debug("intranode send payload %s", payload->toString().c_str()); + out_->debug(CALL_INFO, 1, 0, "intranode send payload %s", + payload->toString().c_str()); switch(payload->type()) { @@ -492,64 +377,30 @@ NIC::finishMemcpy(NetworkMessage* payload) sendToNode(payload); } -void -NIC::recordMessage(NetworkMessage* netmsg) -{ -// nic_debug("sending message %lu of size %ld of type %s to node %d: " -// "netid=%lu for %s", -// netmsg->flowId(), -// netmsg->byteLength(), -// NetworkMessage::tostr(netmsg->type()), -// int(netmsg->toaddr()), -// netmsg->flowId(), netmsg->toString().c_str()); - - if (netmsg->type() == NetworkMessage::null_netmsg_type){ - //assume this is a simple payload +void +NIC::recordMessage(NetworkMessage *netmsg) { + + std::ostringstream debug_stream; + debug_stream << "sending message " << netmsg->flowId() << " of size " + << netmsg->byteLength() << " of type " + << NetworkMessage::tostr(netmsg->type()) << " to node " + << netmsg->toaddr() << ": netid=" << netmsg->flowId() << " for " + << netmsg->toString(); + out_->debug(CALL_INFO, 1, 0, "%s", debug_stream.str().c_str()); + + if (netmsg->type() == NetworkMessage::null_netmsg_type) { + // assume this is a simple payload netmsg->setType(NetworkMessage::smsg_send); } - -// if (spy_bytes_){ -// spy_bytes_->addData(netmsg->toaddr(), netmsg->byteLength()); -// } -// xmit_flows_->addData(netmsg->byteLength()); } void NIC::internodeSend(NetworkMessage* netmsg) { -// if (netmsg->toaddr() >= top_->numNodes()){ -// sst_hg_abort_printf("Got bad destination %d on NIC %d for %s", -// int(netmsg->toaddr()), int(addr()), netmsg->toString().c_str()); -// } - recordMessage(netmsg); -// nic_debug("internode send payload %llu of size %d %s", -// netmsg->flowId(), int(netmsg->byteLength()), netmsg->toString().c_str()); - //we might not have a logp overlay network -// if (negligibleSize(netmsg->byteLength())){ -// sendManagerMsg(netmsg); -// } else { -// doSend(netmsg); -// } doSend(netmsg); } -//void -//NIC::sendManagerMsg(NetworkMessage* msg) -//{ -// if (msg->toaddr() == my_addr_){ -// intranodeSend(msg); -// } else { -//#if SST_HG_SANITY_CHECK -// if (!logp_link_){ -// spkt_abort_printf("NIC %d does not have LogP link", addr()); -// } -//#endif -// logp_link_->send(new NicEvent(msg)); -// ackSend(msg); -// } -//} - void NIC::sendToNode(NetworkMessage* payload) { diff --git a/src/sst/elements/mercury/components/nic.h b/src/sst/elements/mercury/components/nic.h index 421198346e..3383b18593 100644 --- a/src/sst/elements/mercury/components/nic.h +++ b/src/sst/elements/mercury/components/nic.h @@ -1,86 +1,42 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once +#include + #include #include #include -#include #include #include #include +#include #include -//#include +#include #include #include #include -#include -//#include -//#include -//#include #include -#include -#include -//#include -//#include -//#include -//#include -#include #include #include #include #include -//DeclareDebugSlot(nic); - -//#define nic_debug(...) \ -// debug_printf(sprockit::dbg::nic, "NIC on node %d: %s", \ -// int(addr()), sprockit::sprintf(__VA_ARGS__).c_str()) - namespace SST { namespace Hg { @@ -109,7 +65,6 @@ class NicEvent : * the process (ppid) involved. */ class NIC : public SST::Hg::SubComponent -//class NIC : public ConnectableComponent { public: @@ -130,11 +85,6 @@ class NIC : public SST::Hg::SubComponent LogP } Port; - // struct MyRequest : public SST::Interfaces::SimpleNetwork::Request { - // uint64_t flow_id; - // Timestamp start; - // }; - class FlowTracker : public Event { private: uint64_t flow_id; @@ -143,20 +93,6 @@ class NIC : public SST::Hg::SubComponent uint64_t id() const {return flow_id;} }; -// struct MessageEvent : public Event { -// MessageEvent(NetworkMessage* msg) : -// msg_(msg) -// { -// } -// -// NetworkMessage* msg() const { -// return msg_; -// } -// -// private: -// NetworkMessage* msg_; -// }; - private: struct Pending { NetworkMessage* payload; @@ -211,10 +147,6 @@ class NIC : public SST::Hg::SubComponent link_control_ = link_control; } -// Topology* topology() const { -// return top_; -// } - /** * @brief injectSend Perform an operation on the NIC. * This assumes an exlcusive model of NIC use. If NIC is busy, @@ -282,21 +214,10 @@ class NIC : public SST::Hg::SubComponent protected: - void configureLogPLinks(); - - void configureLinks(); - Node* parent() const { return parent_; } - /** - Start the message sending and inject it into the network - This performs all model-specific work - @param payload The network message to send - */ - //virtual void doSend(NetworkMessage* payload) = 0; - bool negligibleSize(int bytes) const { return bytes <= negligibleSize_; } @@ -306,13 +227,9 @@ class NIC : public SST::Hg::SubComponent Node* parent_; NodeId my_addr_; EventLink::ptr logp_link_; - //Topology* top_; private: - //StatSpyplot* spy_bytes_; - //Statistic* xmit_flows_; - //sw::SingleProgressQueue queue_; SST::Interfaces::SimpleNetwork* link_control_; std::vector> pending_; std::vector> ack_queue_; @@ -320,6 +237,7 @@ class NIC : public SST::Hg::SubComponent RecvCQ cq_; int vns_; int test_size_; + std::unique_ptr out_; protected: SST::Hg::OperatingSystem* os_; @@ -337,48 +255,5 @@ class NIC : public SST::Hg::SubComponent void finishMemcpy(NetworkMessage* msg); }; -//class NullNIC : public NIC -//{ -// public: - -// SST_ELI_REGISTER_SUBCOMPONENT_DERIVED( -// NullNIC, -// "hg", -// "null_nic", -// SST_ELI_ELEMENT_VERSION(1,0,0), -// "implements a nic that models nothing - stand-in only", -// SST::Hg::NIC -// ) - -//// SST_ELI_REGISTER_SUBCOMPONENT_DERIVED( -//// NullNIC, -//// "hg", -//// "nullnic", -//// SST_ELI_ELEMENT_VERSION(0,0,1), -//// "Mercury Null NIC", -//// SST::Hg::NIC -//// ) - -// NullNIC(uint32_t id, SST::Params& params, SST::Hg::SimpleNode* parent) : -// NIC(id, params, parent) -// { -// } - -// std::string toString() const override { return "null nic"; } -// //std::string toString() const { return "null nic"; } - -//// void connectOutput(int, int, EventLink::ptr&&) override {} - -//// void connectInput(int, int, EventLink::ptr&&) override {} - -//// SST::Event::HandlerBase* payloadHandler(int) override { return nullptr; } - -//// SST::Event::HandlerBase* creditHandler(int) override { return nullptr; } - -// SST::Event::HandlerBase* payloadHandler(int) { return nullptr; } - -// SST::Event::HandlerBase* creditHandler(int) { return nullptr; } -//}; - } // end of namespace Hg } // end of namespace SST diff --git a/src/sst/elements/mercury/components/nic_fwd.h b/src/sst/elements/mercury/components/nic_fwd.h index 860b5d583a..3f57ee00e9 100644 --- a/src/sst/elements/mercury/components/nic_fwd.h +++ b/src/sst/elements/mercury/components/nic_fwd.h @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once diff --git a/src/sst/elements/mercury/components/node.cc b/src/sst/elements/mercury/components/node.cc index 972cd33eda..1b21526104 100644 --- a/src/sst/elements/mercury/components/node.cc +++ b/src/sst/elements/mercury/components/node.cc @@ -26,7 +26,6 @@ extern template SST::TimeConverter* HgBase::time_converter_; Node::Node(ComponentId_t id, Params ¶ms) : SST::Hg::Component(id), nic_(0) { - my_addr_ = params.find("logicalID",-1); unsigned int verbose = params.find("verbose",0); out_ = std::unique_ptr(new SST::Output(sprintf("Node%d:",my_addr_), verbose, 0, Output::STDOUT)); @@ -55,7 +54,7 @@ Node::Node(ComponentId_t id, Params ¶ms) int ncores_ = params.find("ncores", 1); int nsockets_ = params.find("nsockets",1); -// // Tell the simulation not to end until we're ready + // Tell the simulation not to end until we're ready registerAsPrimaryComponent(); primaryComponentDoNotEndSim(); } diff --git a/src/sst/elements/mercury/components/node.h b/src/sst/elements/mercury/components/node.h index 6f8e69a564..83af9217bb 100644 --- a/src/sst/elements/mercury/components/node.h +++ b/src/sst/elements/mercury/components/node.h @@ -91,6 +91,8 @@ class Node : public SST::Hg::Component { SST::Hg::NIC* nic() { return nic_; } + std::string toString() { return sprintf("HgNode%d:",my_addr_); } + private: SST::Hg::NIC* nic_; diff --git a/src/sst/elements/mercury/components/operating_system.cc b/src/sst/elements/mercury/components/operating_system.cc index f731790c41..2fcf59bb56 100644 --- a/src/sst/elements/mercury/components/operating_system.cc +++ b/src/sst/elements/mercury/components/operating_system.cc @@ -15,17 +15,17 @@ #include -#include #include #include -#include #include #include #include +#include #include #include #include -#include +#include +#include #include #include @@ -42,13 +42,11 @@ extern template class HgBase; extern template class HgBase; extern template SST::TimeConverter* HgBase::time_converter_; -//#if SST_HG_USE_MULTITHREAD +// #if SST_HG_USE_MULTITHREAD std::vector OperatingSystem::active_os_; -//#else -//OperatingSystem* OperatingSystem::active_os_ = nullptr; -//#endif - -//SST::TimeConverter* OperatingSystem::time_converter_ = nullptr; +// #else +// OperatingSystem* OperatingSystem::active_os_ = nullptr; +// #endif class DeleteThreadEvent : public ExecutionEvent @@ -82,27 +80,27 @@ OperatingSystem::OperatingSystem(SST::ComponentId_t id, SST::Params& params, Nod my_addr_ = node_->addr(); next_outgoing_id_.src_node = my_addr_; next_outgoing_id_.msg_num = 0; - //auto os_params = params.get_scoped_params("operating_system"); - //params.print_all_params(std::cerr); - unsigned int verbose = params.find("verbose",0); - out_ = std::unique_ptr(new SST::Output(sprintf("Node%d:OperatingSystem:", my_addr_), verbose, 0, Output::STDOUT)); + verbose_ = params.find("verbose", 0); + out_ = std::unique_ptr( + new SST::Output(sprintf("Node%d:HgOperatingSystem:", my_addr_), verbose_, 0, + Output::STDOUT)); out_->debug(CALL_INFO, 1, 0, "constructing\n"); if (sst_hg_nullptr == nullptr){ int range_bit_size = 30; - sst_hg_nullptr_range = 1ULL<("eventSize", 16); if (!time_converter_){ time_converter_ = SST::BaseComponent::getTimeConverter(tickIntervalString()); } @@ -112,14 +110,14 @@ OperatingSystem::OperatingSystem(SST::ComponentId_t id, SST::Params& params, Nod assert(selfEventLink_); selfEventLink_->setDefaultTimeBase(time_converter_); - out_->verbose(CALL_INFO, 1, 0, "adding launch requests\n"); + out_->debug(CALL_INFO, 1, 0, "adding launch requests\n"); app_launcher_ = new AppLauncher(this); addLaunchRequests(params); - //assume simple for now compute_sched_ = SST::Hg::create( "hg", params.find("compute_scheduler", "simple"), - params, this, node_ ? node_->ncores() : 1, node_ ? node_->nsockets() : 1); + params, this, node_ ? node_->ncores() : 1, node_ ? node_->nsockets() + : 1); StackAlloc::init(params); initThreading(params); @@ -129,10 +127,10 @@ OperatingSystem::~OperatingSystem() { for (auto& pair : pending_library_request_){ std::string name = pair.first; - for (Request* req : pair.second){ - sst_hg_abort_printf("OperatingSystem:: never registered library %s on os %d for event %s", - name.c_str(), int(addr()), - toString(req).c_str()); + for (Request *req : pair.second) { + sst_hg_abort_printf( + "OperatingSystem:: never registered library %s on os %d for event %s", + name.c_str(), int(addr()), toString(req).c_str()); } } @@ -140,7 +138,8 @@ OperatingSystem::~OperatingSystem() des_context_->destroyContext(); delete des_context_; } - if (compute_sched_) delete compute_sched_; + if (compute_sched_) + delete compute_sched_; } void @@ -186,37 +185,23 @@ OperatingSystem::startThread(Thread* t) nullptr); } running_threads_[t->tid()] = t; - - // if (gdb_active_){ - // static thread_lock all_threads_lock; - // all_threads_lock.lock(); - // auto tid = t->tid(); - // Thread*& thrInMap = all_threads_[tid]; - // if (thrInMap){ - // spkt_abort_printf("error: thread %d already exists for app %d", - // t->tid(), thrInMap->aid()); - // } - // thrInMap = t; - // all_threads_lock.unlock(); - // } - } /* Event handler * Incoming events are scanned and deleted * Record if the event received is the last one our neighbor will send */ -void OperatingSystem::handleEvent(SST::Event *ev) { - if (auto *req = dynamic_cast(ev)) { - Params params = req->params(); - //params.print_all_params(std::cerr); - out_->verbose(CALL_INFO, 1, 0, "app name: %s\n", params.find("name").c_str()); - app_launcher_->incomingRequest(req); - } - else { - sst_hg_abort_printf("Error! Bad Event Type received by %s!\n", - getName().c_str()); - } +void +OperatingSystem::handleEvent(SST::Event *ev) { + if (auto *req = dynamic_cast(ev)) { + Params params = req->params(); + out_->debug(CALL_INFO, 1, 0, "app name: %s\n", + params.find("name").c_str()); + app_launcher_->incomingRequest(req); + } else { + sst_hg_abort_printf("Error! Bad Event Type received by %s!\n", + getName().c_str()); + } } @@ -238,36 +223,37 @@ OperatingSystem::addLaunchRequests(SST::Params& params) bool keep_going = true; int aid = 1; SST::Params all_app_params = params.get_scoped_params("app"); - while (keep_going || aid < 10){ - std::string name = sprintf("app%d",aid); - SST::Params app_params = params.get_scoped_params(name); - //app_params.print_all_params(std::cerr); - if (!app_params.empty()){ - app_params.insert(all_app_params); - // bool terminate_on_end = app_params.find("terminate", false); - // if (terminate_on_end){ - // terminators_.insert(aid); - // } - out_->verbose(CALL_INFO, 1, 0, "adding app launch request %d:%s\n", aid, name.c_str()); - out_->flush(); - AppLaunchRequest* mgr = new AppLaunchRequest(app_params, AppId(aid), name); - requests_.push_back(mgr); - keep_going = true; - - App::lockDlopen(aid); - } else { - keep_going = false; - } - ++aid; + while (keep_going || aid < 10) { + std::string name = sprintf("app%d", aid); + SST::Params app_params = params.get_scoped_params(name); + if (!app_params.empty()) { + app_params.insert(all_app_params); + // bool terminate_on_end = app_params.find("terminate", false); + // if (terminate_on_end){ + // terminators_.insert(aid); + // } + out_->debug(CALL_INFO, 1, 0, "adding app launch request %d:%s\n", aid, + name.c_str()); + out_->flush(); + AppLaunchRequest *mgr = + new AppLaunchRequest(app_params, AppId(aid), name); + requests_.push_back(mgr); + keep_going = true; + + App::lockDlopen(aid); + } else { + keep_going = false; } + ++aid; + } } -void -OperatingSystem::startApp(App* theapp, const std::string& /*unique_name*/) -{ - out_->verbose(CALL_INFO, 1, 0, "starting app %d:%d on physical thread %d\n", +void +OperatingSystem::startApp(App *theapp, + const std::string & /*unique_name*/) { + out_->debug(CALL_INFO, 1, 0, "starting app %d:%d on physical thread %d\n", int(theapp->tid()), int(theapp->aid()), threadId()); - //this should be called from the actual thread running it + // this should be called from the actual thread running it initThreading(params_); startThread(theapp); } @@ -277,18 +263,19 @@ OperatingSystem::joinThread(Thread* t) { sst_hg_abort_printf("OperatingSystem::joinThread not fully implemented"); if (t->getState() != Thread::DONE) { - //key* k = key::construct(); - // os_debug("joining thread %ld - thread not done so blocking on thread %p", - // t->threadId(), active_thread_); - t->joiners_.push(active_thread_); - // int ncores = active_thread_->numActiveCcores(); - // //when joining - release all cores - // compute_sched_->releaseCores(ncores, active_thread_); - // block(); - // compute_sched_->reserveCores(ncores, active_thread_); - } else { - // os_debug("joining completed thread %ld", t->threadId()); - } + // key* k = key::construct(); + // os_debug("joining thread %ld - thread not done so blocking on + // thread %p", + // t->threadId(), active_thread_); + t->joiners_.push(active_thread_); + // int ncores = active_thread_->numActiveCcores(); + // //when joining - release all cores + // compute_sched_->releaseCores(ncores, active_thread_); + // block(); + // compute_sched_->reserveCores(ncores, active_thread_); + } else { + // os_debug("joining completed thread %ld", t->threadId()); + } running_threads_.erase(t->tid()); delete t; } @@ -315,15 +302,16 @@ OperatingSystem::completeActiveThread() //if any threads waiting on the join, unblock them while (!thr_todelete->joiners_.empty()) { - Thread* blocker = thr_todelete->joiners_.front(); - out_->verbose(CALL_INFO, 1, 0, "thread %d is unblocking joiner %p\n", + Thread *blocker = thr_todelete->joiners_.front(); + out_->debug(CALL_INFO, 1, 0, "thread %d is unblocking joiner %p\n", thr_todelete->threadId(), blocker); - unblock(blocker); - //to_awake_.push(thr_todelete->joiners_.front()); - thr_todelete->joiners_.pop(); - } - active_thread_ = nullptr; - out_->verbose(CALL_INFO, 1, 0, "completing context %d on thread %d\n", thr_todelete->threadId(), threadId()); + unblock(blocker); + // to_awake_.push(thr_todelete->joiners_.front()); + thr_todelete->joiners_.pop(); + } + active_thread_ = nullptr; + out_->debug(CALL_INFO, 1, 0, "completing context %d on thread %d\n", + thr_todelete->threadId(), threadId()); thr_todelete->context()->completeContext(des_context_); } @@ -337,14 +325,18 @@ OperatingSystem::switchToThread(Thread* tothread) return; } - out_->verbose(CALL_INFO, 1, 0, "switching to context %d on physical thread %d\n", tothread->threadId(), threadId()); - if (active_thread_ == blocked_thread_){ - blocked_thread_ = nullptr; - } + out_->debug(CALL_INFO, 1, 0, + "switching to context %d on physical thread %d\n", + tothread->threadId(), threadId()); + if (active_thread_ == blocked_thread_) { + blocked_thread_ = nullptr; + } active_thread_ = tothread; activeOs() = this; tothread->context()->resumeContext(des_context_); - out_->verbose(CALL_INFO, 1, 0, "switched back from context %d to main thread %d\n", tothread->threadId(), threadId()); + out_->debug(CALL_INFO, 1, 0, + "switched back from context %d to main thread %d\n", + tothread->threadId(), threadId()); /** back to main thread */ active_thread_ = nullptr; } @@ -364,7 +356,8 @@ OperatingSystem::block() Thread* old_thread = active_thread_; //reset the time flag active_thread_->setTimedOut(false); - out_->verbose(CALL_INFO, 1, 0, "pausing context %d on physical thread %d\n", active_thread_->threadId(), threadId()); + out_->debug(CALL_INFO, 1, 0, "pausing context %d on physical thread %d\n", + active_thread_->threadId(), threadId()); blocked_thread_ = active_thread_; active_thread_ = nullptr; old_context->pauseContext(des_context_); @@ -375,17 +368,14 @@ OperatingSystem::block() //restore state to indicate this thread and this OS are active again activeOs() = this; - out_->verbose(CALL_INFO, 1, 0, "resuming context %d on physical thread %d\n", active_thread_->threadId(), threadId()); + out_->debug(CALL_INFO, 1, 0, "resuming context %d on physical thread %d\n", + active_thread_->threadId(), threadId()); active_thread_ = old_thread; active_thread_->incrementBlockCounter(); //collect any statistics associated with the elapsed time Timestamp after = now(); TimeDelta elapsed = after - before; - -// if (elapsed.ticks()){ -// active_thread_->collectStats(before, elapsed); -// } } void @@ -509,17 +499,17 @@ OperatingSystem::registerLib(Library* lib) sprockit::abort("OperatingSystem: trying to register a lib with no name"); } #endif - out_->verbose(CALL_INFO, 1, 0, "registering lib %s:%p\n", lib->libName().c_str(), lib); + out_->debug(CALL_INFO, 1, 0, "registering lib %s:%p\n", lib->libName().c_str(), lib); int& refcount = lib_refcounts_[lib]; ++refcount; libs_[lib->libName()] = lib; - out_->verbose(CALL_INFO, 1, 0, "OS %d should no longer drop events for %s\n", - addr(), lib->libName().c_str()); + out_->debug(CALL_INFO, 1, 0, "OS %d should no longer drop events for %s\n", + addr(), lib->libName().c_str()); auto iter = pending_library_request_.find(lib->libName()); - if (iter != pending_library_request_.end()){ - const std::list reqs = iter->second; - for (Request* req : reqs){ - out_->verbose(CALL_INFO, 1, 0, "delivering delayed event to lib %s: %s\n", + if (iter != pending_library_request_.end()) { + const std::list reqs = iter->second; + for (Request *req : reqs) { + out_->debug(CALL_INFO, 1, 0, "delivering delayed event to lib %s: %s\n", lib->libName().c_str(), toString(req).c_str()); sendExecutionEventNow(newCallback(lib, &Library::incomingRequest, req)); } @@ -527,15 +517,15 @@ OperatingSystem::registerLib(Library* lib) } } -void -OperatingSystem::unregisterLib(Library* lib) -{ - out_->verbose(CALL_INFO, 1, 0, "unregistering lib %s\n", lib->libName().c_str()); - int& refcount = lib_refcounts_[lib]; - if (refcount == 1){ +void +OperatingSystem::unregisterLib(Library *lib) { + out_->debug(CALL_INFO, 1, 0, "unregistering lib %s\n", + lib->libName().c_str()); + int &refcount = lib_refcounts_[lib]; + if (refcount == 1) { lib_refcounts_.erase(lib); - out_->verbose(CALL_INFO, 1, 0, "OS %d will now drop events for %s\n", - addr(), lib->libName().c_str()); + out_->debug(CALL_INFO, 1, 0, "OS %d will now drop events for %s\n", + addr(), lib->libName().c_str()); libs_.erase(lib->libName()); //delete lib; } else { @@ -550,11 +540,11 @@ OperatingSystem::handleLibraryRequest(const std::string& name, Request* req) bool found = it != libs_.end(); if (found){ Library* lib = it->second; - out_->verbose(CALL_INFO, 1, 0, "delivering message to lib %s:%p: %s\n", - name.c_str(), lib, toString(req).c_str()); + out_->debug(CALL_INFO, 1, 0, "delivering message to lib %s:%p: %s\n", + name.c_str(), lib, toString(req).c_str()); lib->incomingRequest(req); } else { - out_->verbose(CALL_INFO, 1, 0, "unable to deliver message to lib %s: %s\n", + out_->debug(CALL_INFO, 1, 0, "unable to deliver message to lib %s: %s\n", name.c_str(), toString(req).c_str()); } return found; @@ -566,18 +556,18 @@ OperatingSystem::handleRequest(Request* req) //this better be an incoming event to a library, probably from off node Flow* libmsg = dynamic_cast(req); if (!libmsg) { - out_->verbose(CALL_INFO, 1, 0, "OperatingSystem::handle_event: got event %s instead of library event\n", - toString(req).c_str()); + out_->debug(CALL_INFO, 1, 0, + "OperatingSystem::handle_event: got event %s instead of library event\n", + toString(req).c_str()); } bool found = handleLibraryRequest(libmsg->libname(), req); - if (!found){ -// os_debug("delaying event to lib %s: %s", -// libmsg->libname().c_str(), libmsg->toString().c_str()); + if (!found) { + out_->debug(CALL_INFO, 1, 0, "delaying event to lib %s: %s", + libmsg->libname().c_str(), libmsg->toString().c_str()); pending_library_request_[libmsg->libname()].push_back(req); } } - } // namespace Hg } // namespace SST diff --git a/src/sst/elements/mercury/components/operating_system.h b/src/sst/elements/mercury/components/operating_system.h index 4143171876..1579d7c15b 100644 --- a/src/sst/elements/mercury/components/operating_system.h +++ b/src/sst/elements/mercury/components/operating_system.h @@ -19,7 +19,6 @@ #include -//#include #include #include #include @@ -43,8 +42,6 @@ namespace Hg { extern template SST::TimeConverter* HgBase::time_converter_; -//static std::string _tick_spacing_string_("1ps"); - class OperatingSystem : public SST::Hg::SubComponent { public: @@ -150,6 +147,7 @@ class OperatingSystem : public SST::Hg::SubComponent { /// to this context on every context switch. ThreadContext *des_context_; + unsigned int verbose_; int nranks_; Node* node_; Thread* active_thread_; @@ -188,8 +186,6 @@ class OperatingSystem : public SST::Hg::SubComponent { static SST::TimeConverter* timeConverter() { return time_converter_; } -// protected: -// static SST::TimeConverter* time_converter_; public: @@ -240,10 +236,6 @@ class OperatingSystem : public SST::Hg::SubComponent { compute_sched_->releaseCores(ncore,thr); } -// NodeId rankToNode(int rank) { -// return NodeId( rank_mapper_->mapRank(rank) ); -// } - void set_nranks(int32_t ranks) { nranks_ = ranks; } @@ -252,8 +244,6 @@ class OperatingSystem : public SST::Hg::SubComponent { return nranks_; } -// SST::Ember::EmberRankMap* rank_mapper_; - // // LIBRARIES // diff --git a/src/sst/elements/mercury/components/operating_system_fwd.h b/src/sst/elements/mercury/components/operating_system_fwd.h index 57078e7125..1aa0c0b124 100644 --- a/src/sst/elements/mercury/components/operating_system_fwd.h +++ b/src/sst/elements/mercury/components/operating_system_fwd.h @@ -13,15 +13,12 @@ // information, see the LICENSE file in the top level directory of the // distribution. -#ifndef sst_hg_software_process_OPERATING_SYSTEM_FWD_H -#define sst_hg_software_process_OPERATING_SYSTEM_FWD_H +#pragma once namespace SST { namespace Hg { class OperatingSystem; -} -} - -#endif // OPERATING_SYSTEM_FWD_H +} // namespace Hg +} // namespace SST diff --git a/src/sst/elements/mercury/hardware/common/packet.h b/src/sst/elements/mercury/hardware/common/packet.h index 24817213d7..941d579475 100644 --- a/src/sst/elements/mercury/hardware/common/packet.h +++ b/src/sst/elements/mercury/hardware/common/packet.h @@ -18,7 +18,6 @@ #include #include #include -//# include namespace SST { namespace Hg { diff --git a/src/sst/elements/mercury/hardware/common/recv_cq.cc b/src/sst/elements/mercury/hardware/common/recv_cq.cc index dbf30a931e..4780585994 100644 --- a/src/sst/elements/mercury/hardware/common/recv_cq.cc +++ b/src/sst/elements/mercury/hardware/common/recv_cq.cc @@ -22,7 +22,6 @@ #include #include #include -//#include namespace SST { namespace Hg { @@ -47,7 +46,7 @@ RecvCQ::recv(uint64_t unique_id, uint32_t bytes, Flow* orig) incomingMsg& incoming = bytes_recved_[unique_id]; #if SST_HG_SANITY_CHECK if (incoming.msg && orig){ - spkt_abort_printf( + sst_hg_abort_printf( "RecvCQ::recv: only one message chunk should carry the parent payload for %" PRIu64 ": %s", unique_id, incoming.msg->toString().c_str()); } diff --git a/src/sst/elements/mercury/libraries/compute/compute_event.h b/src/sst/elements/mercury/libraries/compute/compute_event.h index 2e5b2cc868..bcada40de9 100644 --- a/src/sst/elements/mercury/libraries/compute/compute_event.h +++ b/src/sst/elements/mercury/libraries/compute/compute_event.h @@ -19,13 +19,9 @@ #include #include #include -//#include -//#include #include #include -//DeclareDebugSlot(compute_intensity); - namespace SST { namespace Hg { @@ -106,5 +102,5 @@ struct basic_instructions_st typedef ComputeEvent_impl TimedComputeEvent; typedef ComputeEvent_impl BasicComputeEvent; -} -} // end of namespace +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/libraries/compute/compute_event_fwd.h b/src/sst/elements/mercury/libraries/compute/compute_event_fwd.h index 082e1a5873..fa350e5de8 100644 --- a/src/sst/elements/mercury/libraries/compute/compute_event_fwd.h +++ b/src/sst/elements/mercury/libraries/compute/compute_event_fwd.h @@ -20,7 +20,5 @@ namespace Hg { class ComputeEvent; -} } - - -#endif // COMPUTE_MESSAGE_FWD_H +} // end namespace Hg +} // end namespace SST \ No newline at end of file diff --git a/src/sst/elements/mercury/libraries/compute/lib_compute.cc b/src/sst/elements/mercury/libraries/compute/lib_compute.cc index 8a691629ce..250561aa78 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_compute.cc +++ b/src/sst/elements/mercury/libraries/compute/lib_compute.cc @@ -18,5 +18,5 @@ namespace SST { namespace Hg { -} -} +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/libraries/compute/lib_compute.h b/src/sst/elements/mercury/libraries/compute/lib_compute.h index 9a166cf2a3..b5539b557e 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_compute.h +++ b/src/sst/elements/mercury/libraries/compute/lib_compute.h @@ -47,5 +47,5 @@ class LibCompute : }; -} -} +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/libraries/compute/lib_compute_inst.cc b/src/sst/elements/mercury/libraries/compute/lib_compute_inst.cc index 688f51f3f9..6b99fe9bc7 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_compute_inst.cc +++ b/src/sst/elements/mercury/libraries/compute/lib_compute_inst.cc @@ -18,12 +18,6 @@ #include #include #include -//#include -//#include -//#include -//#include - -//RegisterDebugSlot(lib_compute_inst); namespace SST { namespace Hg { diff --git a/src/sst/elements/mercury/libraries/compute/lib_compute_inst.h b/src/sst/elements/mercury/libraries/compute/lib_compute_inst.h index 26518f4bd5..402a822e55 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_compute_inst.h +++ b/src/sst/elements/mercury/libraries/compute/lib_compute_inst.h @@ -19,11 +19,6 @@ #include #include #include -//#include - -//these are the default instruction labels - -//DeclareDebugSlot(lib_compute_inst); namespace SST { namespace Hg { diff --git a/src/sst/elements/mercury/libraries/compute/lib_compute_memmove.cc b/src/sst/elements/mercury/libraries/compute/lib_compute_memmove.cc index 0fd7bfe701..e722ac7104 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_compute_memmove.cc +++ b/src/sst/elements/mercury/libraries/compute/lib_compute_memmove.cc @@ -20,8 +20,6 @@ #include #include #include -//#include -//#include namespace SST { namespace Hg { @@ -43,9 +41,6 @@ LibComputeMemmove::LibComputeMemmove(SST::Params& params, void LibComputeMemmove::doAccess(uint64_t bytes) { - //if (bytes == 0){ - // return; - //} uint64_t num_loops = bytes / access_width_bytes_; int nflops = 0; int nintops = 1; //memmove instruction @@ -74,5 +69,5 @@ LibComputeMemmove::copy(uint64_t bytes) } -} -} //end of namespace +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/libraries/compute/lib_compute_memmove.h b/src/sst/elements/mercury/libraries/compute/lib_compute_memmove.h index c23ffa5e9c..c84f778907 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_compute_memmove.h +++ b/src/sst/elements/mercury/libraries/compute/lib_compute_memmove.h @@ -55,5 +55,5 @@ class LibComputeMemmove : }; -} -} //end of namespace +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/libraries/compute/lib_compute_time.cc b/src/sst/elements/mercury/libraries/compute/lib_compute_time.cc index 800ffdbeeb..10d430d6ce 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_compute_time.cc +++ b/src/sst/elements/mercury/libraries/compute/lib_compute_time.cc @@ -19,7 +19,6 @@ #include #include #include -//#include namespace SST { namespace Hg { @@ -65,5 +64,5 @@ LibComputeTime::sleep(TimeDelta time) os_->sleep(time); } -} -} //end of namespace +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/libraries/compute/lib_compute_time.h b/src/sst/elements/mercury/libraries/compute/lib_compute_time.h index c1f0be5265..3fefbb623d 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_compute_time.h +++ b/src/sst/elements/mercury/libraries/compute/lib_compute_time.h @@ -50,5 +50,5 @@ class LibComputeTime : }; -} -} //end of namespace +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/libraries/compute/lib_hybrid_compute.h b/src/sst/elements/mercury/libraries/compute/lib_hybrid_compute.h index 759c3b73a2..fce5facf3d 100644 --- a/src/sst/elements/mercury/libraries/compute/lib_hybrid_compute.h +++ b/src/sst/elements/mercury/libraries/compute/lib_hybrid_compute.h @@ -39,5 +39,5 @@ class lib_hybrid_compute : }; -} -} //end of namespace +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/operating_system/launch/app_launcher.cc b/src/sst/elements/mercury/operating_system/launch/app_launcher.cc index 0f57b18bd0..da62258ff7 100644 --- a/src/sst/elements/mercury/operating_system/launch/app_launcher.cc +++ b/src/sst/elements/mercury/operating_system/launch/app_launcher.cc @@ -35,73 +35,16 @@ AppLauncher::incomingRequest(AppLaunchRequest* req) { Params app_params = req->params(); SoftwareId sid(req->aid(), os_->addr()-1); - std::string app_name; if (app_params.count("label")) { app_name = app_params.find("label",""); } else app_name = app_params.find("name",""); - //std::cerr << "launching app_name " << app_name << std::endl; std::string exe = app_params.find("exe",""); - //std::cerr << "launching exe " << exe << std::endl; - App::dlopenCheck(req->aid(), app_params); - //app_params.print_all_params(std::cerr); App* theapp = create("hg", app_name, app_params, sid, os_); - //theapp->setUniqueName(lreq->uniqueName()); - //int intranode_rank = num_apps_launched_[lreq->aid()]++; - //int core_affinity = lreq->coreAffinity(intranode_rank); - //if (core_affinity != Thread::no_core_affinity){ - // theapp->setAffinity(core_affinity); - // } - os_->startApp(theapp, "my unique name"); } -//void -//AppLauncher::start() -//{ -// Service::start(); -// if (!os_) { -// spkt_throw_printf(sprockit::ValueError, -// "AppLauncher::start: OS hasn't been registered yet"); -// } -//} - -//hw::NetworkMessage* -//LaunchRequest::cloneInjectionAck() const -//{ -// spkt_abort_printf("launch event should never be cloned for injection"); -// return nullptr; -//} - -//int -//StartAppRequest::coreAffinity(int /*intranode_rank*/) const -//{ -// return Thread::no_core_affinity; -//} - -//void -//StartAppRequest::serialize_order(serializer &ser) -//{ -// LaunchRequest::serialize_order(ser); -// ser & unique_name_; -// ser & app_params_; -// mapping_ = TaskMapping::serialize_order(aid(), ser); -//} - -//std::string -//StartAppRequest::toString() const -//{ -// return sprockit::sprintf("start_app_event: app=%d task=%d node=%d", aid(), tid(), toaddr()); -//} - -//std::string -//JobStopRequest::toString() const -//{ -// return sprockit::sprintf("job_stop_event: app=%d task=%d node=%d", aid(), tid(), fromaddr()); -//} - - -} -} +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/operating_system/libraries/api.cc b/src/sst/elements/mercury/operating_system/libraries/api.cc index d872cd7e02..36f7deabb5 100644 --- a/src/sst/elements/mercury/operating_system/libraries/api.cc +++ b/src/sst/elements/mercury/operating_system/libraries/api.cc @@ -15,14 +15,11 @@ #include #include -//#include #include #include #include #include -//#include #include -//#include namespace SST { namespace Hg { @@ -66,18 +63,11 @@ API::activeThread() void API::startAPICall() { -// if (host_timer_){ -// host_timer_->start(); -// } activeThread()->startAPICall(); } void API::endAPICall() { -// if (host_timer_) { -// double time = host_timer_->stamp(); -// api_parent_app_->compute(TimeDelta(time)); -// } activeThread()->endAPICall(); } diff --git a/src/sst/elements/mercury/operating_system/libraries/api.h b/src/sst/elements/mercury/operating_system/libraries/api.h index d0963aea5b..6bb662afe1 100644 --- a/src/sst/elements/mercury/operating_system/libraries/api.h +++ b/src/sst/elements/mercury/operating_system/libraries/api.h @@ -17,7 +17,6 @@ #include #include -//#include #include #include #include diff --git a/src/sst/elements/mercury/operating_system/process/app.cc b/src/sst/elements/mercury/operating_system/process/app.cc index 3227e0757a..854d555138 100644 --- a/src/sst/elements/mercury/operating_system/process/app.cc +++ b/src/sst/elements/mercury/operating_system/process/app.cc @@ -26,40 +26,13 @@ #include #include #include -//#include -//#include -//#include #include -//#include -//#include -//#include -//#include -//#include -//#include #include -//#include -//#include -//#include -//#include -//#include #include #include #include #include -//static sprockit::NeedDeletestatics del_app_statics; - -//RegisterKeywords( -// { "host_compute_timer", "whether to use the time elapsed on the host machine in compute modeling" }, -// { "min_op_cutoff", "the minimum number of operations in a compute before detailed modeling is perfromed" }, -// { "notify", "whether the app should send completion notifications to job root" }, -// { "globals_size", "the size of the global variable segment to allocate" }, -// { "OMP_NUM_THREADS", "environment variable for configuring openmp" }, -// { "exe", "an optional exe .so file to load for this app" }, -//); - -//MakeDebugSlot(app_compute); - void sst_hg_app_loaded(int /*aid*/){} extern "C" FILE* sst_hg_stdout(){ @@ -153,12 +126,9 @@ App::unlockDlopen_API(std::string api_name) void App::dlopenCheck(int aid, SST::Params& params, bool check_name) { - //params.print_all_params(std::cerr); std::vector apis; if (params.contains("apis")){ params.find_array("apis", apis); -// for (auto i: apis) -// std::cerr << i << std::endl; } else { apis.push_back("systemAPI:libsystemapi.so"); @@ -177,7 +147,6 @@ App::dlopenCheck(int aid, SST::Params& params, bool check_name) file = str.substr(pos + 1); } - //std::cerr << "loading " << name.c_str() << " API from " << file.c_str() << "\n";; dlopen_lock.lock(); dlopen_entry& entry = api_dlopens_[name]; entry.name = file; @@ -194,7 +163,6 @@ App::dlopenCheck(int aid, SST::Params& params, bool check_name) if (params.contains("exe")){ dlopen_lock.lock(); std::string libname = params.find("exe"); - //std::cerr << libname << std::endl; dlopen_entry& entry = exe_dlopens_[aid]; entry.name = libname; if (entry.refcount == 0 || !entry.loaded){ @@ -280,45 +248,26 @@ App::App(SST::Params& params, SoftwareId sid, notify_(true), rc_(0) { - out_ = std::unique_ptr(new SST::Output(sprintf("application%d:", sid.app_), 1, 0, Output::STDOUT)); - out_->debug(CALL_INFO, 1, 0, "constructing"); + unsigned int verbose = params.find("verbose", 0); + out_ = std::unique_ptr( + new SST::Output("app:", verbose, 0, Output::STDOUT)); //globals_storage_ = allocateDataSegment(false); //not tls min_op_cutoff_ = params.find("min_op_cutoff", 1000); -// bool host_compute = params.find("host_compute_timer", false); -// if (host_compute){ -// host_timer_ = new HostTimer; -// } notify_ = params.find("notify", true); SST::Params env_params = params.get_scoped_params("env"); -// omp_contexts_.emplace_back(); -// omp_context& active = omp_contexts_.back(); -// active.max_num_subthreads = active.requested_num_subthreads = -// env_params.find("OMP_NUM_THREADS", 1); -// active.level = 0; -// active.num_threads = 1; std::set keys = env_params.getKeys(); for (auto& key : keys){ env_[key] = env_params.find(key); } -// for (auto iter=os->env_begin(); iter != os->env_end(); ++iter){ -// auto my_iter = env_.find(iter->first); -// if (my_iter == env_.end()){ -// //don't overwrite - app env taks precedence -// env_[iter->first] = iter->second; -// } -// } - std::vector apis; if (params.contains("apis")){ params.find_array("apis", apis); } else { -// apis.push_back("mpi"); -// apis.push_back("sumi:mpi"); apis.push_back("systemAPI:libsystemapi.so"); } @@ -334,15 +283,13 @@ App::App(SST::Params& params, SoftwareId sid, alias = str.substr(pos + 1); } - out_->debug(CALL_INFO, 1, 0, "checking %s API", name.c_str()); + out_->debug(CALL_INFO, 1, 0, "checking %s API\n", name.c_str()); if (name != "SimTransport") { auto iter = apis_.find(name); if (iter == apis_.end()){ - out_->debug(CALL_INFO, 1, 0, "loading %s API", name.c_str()); + out_->debug(CALL_INFO, 1, 0, "loading %s API\n", name.c_str()); SST::Params api_params = params.get_scoped_params(name); - //SST::Component* comp = dynamic_cast(os->node()); - //if(!comp) sst_hg_abort_printf("APP can't dyncast to SST::Component*"); API* api = SST::Hg::create( "hg", name, api_params, this, os->node()); apis_[name] = api; @@ -411,9 +358,6 @@ App::App(SST::Params& params, SoftwareId sid, App::~App() { - /** These get deleted by unregister */ - //sprockit::delete_vals(apis_); -// if (compute_lib_) delete compute_lib_; if (globals_storage_) delete[] globals_storage_; } @@ -477,15 +421,6 @@ App::getenv(const std::string &name) const return my_buf; } -//LibComputeMemmove* -//App::computeLib() -//{ -// if(!compute_lib_) { -// compute_lib_ = new LibComputeMemmove(params_, sid_, os_); -// } -// return compute_lib_; -//} - void App::deleteStatics() { @@ -519,64 +454,12 @@ App::compute(TimeDelta time) //computeLib()->compute(time); } -//void -//App::computeInst(ComputeEvent* cmsg) -//{ -// computeLib()->computeInst(cmsg); -//} - -//void -//App::computeLoop(uint64_t num_loops, -// int nflops_per_loop, -// int nintops_per_loop, -// int bytes_per_loop) -//{ -// computeLib()->LibComputeInst::computeLoop( -// num_loops, nflops_per_loop, nintops_per_loop, bytes_per_loop); -//} - -//void -//App::computeDetailed(uint64_t flops, uint64_t nintops, uint64_t bytes, int nthread) -//{ -// static const uint64_t overflow = 18006744072479883520ull; -// if (flops > overflow || bytes > overflow){ -// spkt_abort_printf("flops/byte counts for compute overflowed"); -// } -// if ((flops+nintops) < min_op_cutoff_){ -// return; -// } - -// debug_printf(sprockit::dbg::app_compute, -// "Rank %d for app %d: detailed compute for flops=%" PRIu64 " intops=%" PRIu64 " bytes=%" PRIu64, -// sid_.task_, sid_.app_, flops, nintops, bytes); - -// computeLib()->computeDetailed(flops, nintops, bytes, nthread); -//} - -//void -//App::computeBlockRead(uint64_t bytes) -//{ -// computeLib()->read(bytes); -//} - -//void -//App::computeBlockWrite(uint64_t bytes) -//{ -// computeLib()->write(bytes); -//} - SST::Params App::getParams() { return OperatingSystem::currentThread()->parentApp()->params(); } -//void -//App::computeBlockMemcpy(uint64_t bytes) -//{ -// computeLib()->copy(bytes); -//} - API* App::getAPI(const std::string &name) { @@ -732,7 +615,6 @@ UserAppCxxFullMain::UserAppCxxFullMain(SST::Params& params, SoftwareId sid, void UserAppCxxFullMain::aliasMains() { - //std::cerr << "UserAppCxxFullMain::aliasMains()\n"; static thread_lock lock; lock.lock(); if (!main_fxns_){ @@ -740,13 +622,9 @@ UserAppCxxFullMain::aliasMains() main_fxns_init_ = nullptr; } auto* lib = App::getBuilderLibrary("hg"); - //std::cerr << "lib: " << lib << "\n"; - //std::cerr << "got Builder Library\n"; if (main_fxns_){ - //std::cerr << "have main_fxns_\n"; for (auto& pair : *main_fxns_){ auto* builder = lib->getBuilder("UserAppCxxFullMain"); - //std::cerr << "adding " << pair.first << " builder " << builder << "\n"; lib->addBuilder(pair.first, builder); } } @@ -759,7 +637,6 @@ UserAppCxxFullMain::aliasMains() void UserAppCxxFullMain::registerMainFxn(const char *name, App::main_fxn fxn) { - //std::cerr << "registering full main " << name << "\n"; if (main_fxns_){ //already passed static init (*main_fxns_)[name] = fxn; } else { @@ -852,7 +729,6 @@ UserAppCxxEmptyMain::UserAppCxxEmptyMain(SST::Params& params, SoftwareId sid, void UserAppCxxEmptyMain::registerMainFxn(const char *name, App::empty_main_fxn fxn) { - //std::cerr << "registering empty main " << name << "\n"; if (empty_main_fxns_){ //already cleared static init (*empty_main_fxns_)[name] = fxn; } else { @@ -870,25 +746,5 @@ UserAppCxxEmptyMain::skeletonMain() return (*fxn_)(); } -//void computeTime(double tsec) -//{ -// Thread* t = OperatingSystem::currentThread(); -// App* a = safe_cast(App, t, -// "cannot cast current thread to app in compute_time function"); -// a->compute(TimeDelta(tsec)); -//} - -} -} - -namespace sstmac { - -std::ostream& cout_wrapper(){ - return std::cout; -} - -std::ostream& cerr_wrapper(){ - return std::cerr; -} - -} +} // end of namespace Hg +} // end of namespace SST diff --git a/src/sst/elements/mercury/operating_system/process/app.h b/src/sst/elements/mercury/operating_system/process/app.h index cb392a0f4c..ac643544c0 100644 --- a/src/sst/elements/mercury/operating_system/process/app.h +++ b/src/sst/elements/mercury/operating_system/process/app.h @@ -18,7 +18,6 @@ #include #include -//#include #include #include #include @@ -73,21 +72,6 @@ class App : public Thread void compute(TimeDelta time); -// void computeInst(ComputeEvent* cmsg); - -// void computeLoop(uint64_t num_loops, -// int nflops_per_loop, -// int nintops_per_loop, -// int bytes_per_loop); - -// void computeBlockRead(uint64_t bytes); - -// void computeBlockWrite(uint64_t bytes); - -// void computeBlockMemcpy(uint64_t bytes); - -// LibComputeMemmove* computeLib(); - ~App() override; void cleanup() override; @@ -236,7 +220,6 @@ class App : public Thread void computeDetailed(uint64_t flops, uint64_t intops, uint64_t bytes, int nthread); -// LibComputeMemmove* compute_lib_; std::string unique_name_; int next_tls_key_; diff --git a/src/sst/elements/mercury/operating_system/process/compute_scheduler.cc b/src/sst/elements/mercury/operating_system/process/compute_scheduler.cc index 5ed9af6820..f15ce9d059 100644 --- a/src/sst/elements/mercury/operating_system/process/compute_scheduler.cc +++ b/src/sst/elements/mercury/operating_system/process/compute_scheduler.cc @@ -17,8 +17,6 @@ #include #include -//RegisterDebugSlot(compute_scheduler, "Print all debug information related to the OS compute scheduler"); - namespace SST { namespace Hg { diff --git a/src/sst/elements/mercury/operating_system/process/compute_scheduler.h b/src/sst/elements/mercury/operating_system/process/compute_scheduler.h index 90ad1a0f09..3d25bd36b3 100644 --- a/src/sst/elements/mercury/operating_system/process/compute_scheduler.h +++ b/src/sst/elements/mercury/operating_system/process/compute_scheduler.h @@ -17,14 +17,10 @@ #include #include -//#include #include #include #include #include -//#include - -//DeclareDebugSlot(compute_scheduler) namespace SST { namespace Hg { diff --git a/src/sst/elements/mercury/operating_system/process/loadlib.cc b/src/sst/elements/mercury/operating_system/process/loadlib.cc index 81fdd2587f..564fcf7a38 100644 --- a/src/sst/elements/mercury/operating_system/process/loadlib.cc +++ b/src/sst/elements/mercury/operating_system/process/loadlib.cc @@ -73,8 +73,6 @@ void* loadExternLibrary(const std::string& libname, const std::string& searchPat libname.c_str(), searchPath.c_str()); } - //std::cerr << "Loading external library " << fullpath << std::endl; - // This is a little weird, but always try the last path - if we // didn't succeed in the stat, we'll get a file not found error // from dlopen, which is a useful error message for the user. diff --git a/src/sst/elements/mercury/operating_system/process/progress_queue.cc b/src/sst/elements/mercury/operating_system/process/progress_queue.cc index ae28967384..6d5e5d468a 100644 --- a/src/sst/elements/mercury/operating_system/process/progress_queue.cc +++ b/src/sst/elements/mercury/operating_system/process/progress_queue.cc @@ -1,46 +1,18 @@ -/** -Copyright 2009-2024 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. +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. -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-2024, 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 sst-macro-help@sandia.gov -*/ #include #include #include @@ -95,5 +67,5 @@ PollingQueue::unblock() ProgressQueue::unblock(pending_threads_); } -} -} +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/operating_system/process/progress_queue.h b/src/sst/elements/mercury/operating_system/process/progress_queue.h index 1f26d12a9e..46d304432a 100644 --- a/src/sst/elements/mercury/operating_system/process/progress_queue.h +++ b/src/sst/elements/mercury/operating_system/process/progress_queue.h @@ -1,46 +1,17 @@ -/** -Copyright 2009-2024 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-2024, 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 sst-macro-help@sandia.gov -*/ +// Copyright 2009-2024 NTESS. Under the terms +// of Contract DE-NA0003525 with NTESS, the U.S. +// Government retains certain rights in this software. +// +// Copyright (c) 2009-2024, 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. #pragma once @@ -261,6 +232,6 @@ struct MultiProgressQueue : public ProgressQueue { }; -} -} +} // end namespace Hg +} // end namespace SST diff --git a/src/sst/elements/mercury/operating_system/process/simple_compute_scheduler.cc b/src/sst/elements/mercury/operating_system/process/simple_compute_scheduler.cc index bd9dc7cb3d..9830a80a53 100644 --- a/src/sst/elements/mercury/operating_system/process/simple_compute_scheduler.cc +++ b/src/sst/elements/mercury/operating_system/process/simple_compute_scheduler.cc @@ -16,7 +16,6 @@ #include #include #include -//#include namespace SST { namespace Hg { diff --git a/src/sst/elements/mercury/operating_system/process/thread.cc b/src/sst/elements/mercury/operating_system/process/thread.cc index c6ec23b163..0f780069d0 100644 --- a/src/sst/elements/mercury/operating_system/process/thread.cc +++ b/src/sst/elements/mercury/operating_system/process/thread.cc @@ -18,14 +18,9 @@ #include #include #include -//#include #include #include #include -//#include -//#include -//#include -//#include #include #include @@ -36,10 +31,6 @@ #include #include -//#include - -//MakeDebugSlot(host_compute) - using namespace std; namespace SST { @@ -170,11 +161,6 @@ Thread::Thread(SST::Params& params, SoftwareId sid, OperatingSystem* os) : { //make all cores possible active cpumask_ = ~(cpumask_); - - //auto* ftq_stat = os->node()->registerMultiStatistic(params, "ftq", subname); - //this will either be a null stat or an ftq stat - //the rest of the code will do null checks on the variable before dumping traces - //ftq_trace_ = dynamic_cast(ftq_stat) } void @@ -199,8 +185,6 @@ Thread::endAPICall() uint32_t Thread::initId() { - //abort("aborting Thread::initID\n"); - //thread id not yet initialized if (thread_id_ == Thread::main_thread) thread_id_ = THREAD_ID_CNT++; //I have not yet been assigned a process context (address space) @@ -231,39 +215,10 @@ Thread::setTlsValue(long thekey, void *ptr) tls_values_[thekey] = ptr; } -//void -//Thread::appendBacktrace(int /*id*/) -//{ -//#if SST_HG_HAVE_CALL_GRAPH -// backtrace_[bt_nfxn_] = id; -// bt_nfxn_++; -//#else -// sprockit::abort("did not compile with call graph support"); -//#endif -//} - -//void -//Thread::popBacktrace() -//{ -// --bt_nfxn_; -// last_bt_collect_nfxn_ = std::min(last_bt_collect_nfxn_, bt_nfxn_); -//} - -//void -//Thread::recordLastBacktrace(int nfxn) -//{ -// last_bt_collect_nfxn_ = nfxn; -//} - void Thread::spawn(Thread* thr) { -// abort("abort Thread::spawn\n"); thr->parent_app_ = parentApp(); -// if (host_timer_){ -// thr->host_timer_ = new HostTimer; -// thr->host_timer_->start(); -// } os_->startThread(thr); } @@ -285,61 +240,6 @@ Thread::~Thread() //if (host_timer_) delete host_timer_; } -//void -//Thread::spawnOmpParallel() -//{ -// spkt_abort_printf("unimplemented: spawn_omp_parallel"); -// omp_context& active = omp_contexts_.back(); -// active.subthreads.resize(active.requested_num_subthreads); -// // App* parent = parentApp(); -// // for (int i=1; i < active.requested_num_subthreads; ++i){ -// // thread* thr = new thread(params, parent->sid(), os_); -// // thr->setOmpParentContext(active); -// // startThread(thr); -// // active.subthreads[i] = thr; -// // } -// //and finally have this thread enter the region as thread 0 -// setOmpParentContext(0, active); -//} - -//void -//Thread::setOmpParentContext(int id, const omp_context& context) -//{ -// omp_contexts_.emplace_back(); -// omp_context& active = omp_contexts_.back(); -// active.level = context.level + 1; -// active.num_threads = context.requested_num_subthreads; -// active.max_num_subthreads = active.requested_num_subthreads = -// context.max_num_subthreads / context.requested_num_subthreads; -// active.id = id; -// active.parent_id = context.id; -//} - -//void -//Thread::computeDetailed(uint64_t flops, uint64_t nintops, uint64_t bytes, int nthread) -//{ -// omp_context& active = omp_contexts_.back(); -// int used_nthread = nthread == use_omp_num_threads ? active.num_threads : nthread; -// parentApp()->computeDetailed(flops, nintops, bytes, used_nthread); -//} - -//void -//Thread::collectStats( -// Timestamp start, -// TimeDelta elapsed) -//{ -//#if !SSTMAC_INTEGRATED_SST_CORE -//#if SST_HG_HAVE_CALL_GRAPH -// if (callGraph_) { -// callGraph_->collect(elapsed.ticks(), this); -// } -//#endif -// if (ftq_trace_){ -// ftq_trace_->addData(ftag_.id(), start.time.ticks(), elapsed.ticks()); -// } -//#endif -//} - void Thread::startThread(Thread* thr) { @@ -347,13 +247,6 @@ Thread::startThread(Thread* thr) os_->startThread(thr); } -//void -//Thread::setCpumask(uint64_t cpumask) -//{ -// cpumask_ = cpumask; -// os_->reassignCores(this); -//} - void Thread::join() { @@ -370,96 +263,3 @@ Thread::join() } // end namespace Hg } // end namespace SST - -//#include -//#include - -//namespace sstmac { -//namespace sw { - -//class stdThread : public Thread { -// public: -// stdThread(std_thread_base* base, -// Thread* parent) : -// Thread(parent->parentApp()->params(), -// SoftwareId(parent->aid(), parent->tid(), -1), -// parent->os()), -// base_(base) -// { -// parent_app_ = parent->parentApp(); -// //std threads need to be joinable -// setDetachState(JOINABLE); -// } - -// void run() override { -// base_->run(); -// } - -// private: -// std_thread_base* base_; -//}; - -//int start_std_thread(std_thread_base* base) -//{ -// Thread* parent = OperatingSystem::currentThread(); -// stdThread* thr = new stdThread(base, parent); -// base->setOwner(thr); -// parent->os()->startThread(thr); -// return thr->threadId(); -//} - -//void join_std_thread(std_thread_base *thr) -//{ -// thr->owner()->join(); -//} - - -//stdMutex::stdMutex() -//{ -// parent_app_ = OperatingSystem::currentThread()->parentApp(); -// id_ = parent_app_->allocateMutex(); -//} - -//void stdMutex::lock() -//{ -// mutex_t* mut = parent_app_->getMutex(id_); -// if (mut == nullptr){ -// spkt_abort_printf("error: bad mutex id for std::mutex: %d", id_); -// } else if (mut->locked) { -// mut->waiters.push_back(OperatingSystem::currentThread()); -// parent_app_->os()->block(); -// } else { -// mut->locked = true; -// } -//} - -//stdMutex::~stdMutex() -//{ -// parent_app_->eraseMutex(id_); -//} - -//void stdMutex::unlock() -//{ -// mutex_t* mut = parent_app_->getMutex(id_); -// if (mut == nullptr || !mut->locked){ -// return; -// } else if (!mut->waiters.empty()){ -// Thread* blocker = mut->waiters.front(); -// mut->waiters.pop_front(); -// parent_app_->os()->unblock(blocker); -// } else { -// mut->locked = false; -// } -//} - -//bool stdMutex::try_lock() -//{ -// mutex_t* mut = parent_app_->getMutex(id_); -// if (mut == nullptr){ -// return false; -// } else if (mut->locked){ -// return false; -// } else { -// return true; -// } -//} diff --git a/src/sst/elements/mercury/operating_system/process/thread.h b/src/sst/elements/mercury/operating_system/process/thread.h index b2a7c854bd..7acc2b0836 100644 --- a/src/sst/elements/mercury/operating_system/process/thread.h +++ b/src/sst/elements/mercury/operating_system/process/thread.h @@ -168,12 +168,6 @@ class Thread return os_; } -// void collectStats(Timestamp start, TimeDelta elapsed); - -// const int* backtrace() const { -// return backtrace_; -// } - virtual bool isMainThread() const { return false; } @@ -202,12 +196,6 @@ class Thread ++block_counter_; } -// void appendBacktrace(int fxnId); - -// void popBacktrace(); - -// void recordLastBacktrace(int nfxn); - void initThread(const SST::Params& params, int phyiscal_thread_id, ThreadContext* tocopy, void *stack, int stacksize, void* globals_storage, void* tls_storage); @@ -281,46 +269,6 @@ class Thread void computeDetailed(uint64_t flops, uint64_t intops, uint64_t bytes, int nthread=use_omp_num_threads); -// int ompGetThreadNum() const { -// auto& active = omp_contexts_.back(); -// return active.id; -// } - -// int ompGetNumThreads() const { -// auto& active = omp_contexts_.back(); -// return active.num_threads; -// } - -// int ompGetMaxThreads() const { -// auto& active = omp_contexts_.back(); -// return active.max_num_subthreads; -// } - -// int ompGetAncestorThreadNum() const { -// auto& active = omp_contexts_.back(); -// return active.parent_id; -// } - -// void ompSetNumThreads(int thr) { -// auto& active = omp_contexts_.back(); -// active.requested_num_subthreads = thr; -// } - -// int ompGetLevel() const { -// auto& active = omp_contexts_.back(); -// return active.level; -// } - -// int ompInParallel() { -// auto& active = omp_contexts_.back(); -// bool parallel = active.level > 0; -// return parallel ? 1 : 0; -// } - -// template static T* getCurrentApi(){ -// return current()->getApi(); -// } - void* getTlsValue(long thekey) const; void setTlsValue(long thekey, void* ptr); @@ -331,20 +279,6 @@ class Thread void endAPICall(); -// void setTag(const FTQTag& t){ -// ftag_ = t; -// } - -// const FTQTag& tag() const { -// return ftag_; -// } - -// void spawnOmpParallel(); - -// CallGraph* callGraph() const { -// return callGraph_; -// } - protected: Thread(SST::Params& params, SoftwareId sid, OperatingSystem* os); @@ -389,8 +323,6 @@ class Thread ProcessContext p_txt_; -// FTQTag ftag_; - SoftwareId sid_; // HostTimer* host_timer_; @@ -398,8 +330,6 @@ class Thread private: API* getAppApi(const std::string& name) const; -// CallGraphTrace backtrace_; //each function is labeled by unique integer - int last_bt_collect_nfxn_; int bt_nfxn_; @@ -429,11 +359,6 @@ class Thread detach_t detach_state_; std::list omp_contexts_; - -// CallGraph* callGraph_; - -// FTQCalendar* ftq_trace_; - }; } // end namespace Hg diff --git a/src/sst/elements/mercury/operating_system/process/thread_info.cc b/src/sst/elements/mercury/operating_system/process/thread_info.cc index a8281b8c90..a0ebf9b054 100644 --- a/src/sst/elements/mercury/operating_system/process/thread_info.cc +++ b/src/sst/elements/mercury/operating_system/process/thread_info.cc @@ -19,10 +19,6 @@ #include #include #include -//#include -//#include -//#include -//#include #include #include diff --git a/src/sst/elements/mercury/pymercury.py b/src/sst/elements/mercury/pymercury.py index a498ce619e..ebd95d8215 100644 --- a/src/sst/elements/mercury/pymercury.py +++ b/src/sst/elements/mercury/pymercury.py @@ -29,6 +29,7 @@ def __init__(self, job_id, numNodes, numCores = 1, nicsPerNode = 1): self._numNodes = numNodes self.node = HgNode() self.os = HgOS() + self.nic = HgNIC() def getName(self): return "HgJob" @@ -38,7 +39,7 @@ def build(self, nodeID, extraKeys): logical_id = self._nid_map[nodeID] node = self.node.build(nodeID,logical_id,self._numNodes * self._numCores) os = self.os.build(node,"os_slot") - nic = node.setSubComponent("nic_slot", "hg.nic") + nic = self.nic.build(node,"nic_slot") # Build NetworkInterface networkif, port_name = self.network_interface.build(node,"link_control_slot",0,self.job_id,self.size,logical_id,True) @@ -49,20 +50,38 @@ class HgNode(TemplateBase): def __init__(self): TemplateBase.__init__(self) + self._declareParams("params",["verbose",]) + self._subscribeToPlatformParamSet("node") def build(self,nid,lid,nranks): + if self._check_first_build(): + sst.addGlobalParams("params_%s"%self._instance_name, self._getGroupParams("params")) node = sst.Component("node" + str(nid), "hg.node") + node.addGlobalParamSet("params_%s"%self._instance_name) node.addParam("nodeID", nid) node.addParam("logicalID", lid) node.addParam("nranks", nranks) return node +class HgNIC(TemplateBase): + def __init__(self): + TemplateBase.__init__(self) + self._declareParams("params",["verbose",]) + self._subscribeToPlatformParamSet("nic") + + def build(self,comp,slot): + if self._check_first_build(): + sst.addGlobalParams("params_%s"%self._instance_name, self._getGroupParams("params")) + nic = comp.setSubComponent(slot,"hg.nic") + nic.addGlobalParamSet("params_%s"%self._instance_name) + return nic + class HgOS(TemplateBase): def __init__(self): TemplateBase.__init__(self) self._declareParams("params",["verbose",]) - self._declareParamsWithUserPrefix("params","app1",["name","exe","apis"],"app1.") + self._declareParamsWithUserPrefix("params","app1",["name","exe","apis","verbose"],"app1.") self._subscribeToPlatformParamSet("operating_system") def build(self,comp,slot): From 55bc053f5489dc7c5740916e9c901c989c06665b Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 13 Nov 2024 20:08:33 +0000 Subject: [PATCH 2/2] merlin/linkcontrol: fix memory leak on insufficient send credits LinkControl::send allocates a RtrEvent to first compute the number of flits needed to send a request. If there's not enough credits, the method returns early without deleting the RtrEvent object and leaks its memory. This patch deletes the object before returning to fix the leak. --- src/sst/elements/merlin/interfaces/linkControl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sst/elements/merlin/interfaces/linkControl.cc b/src/sst/elements/merlin/interfaces/linkControl.cc index 18851524df..724067f24e 100644 --- a/src/sst/elements/merlin/interfaces/linkControl.cc +++ b/src/sst/elements/merlin/interfaces/linkControl.cc @@ -443,7 +443,11 @@ bool LinkControl::send(SimpleNetwork::Request* req, int vn) { int flits = ev->getSizeInFlits(); // Check to see if there are enough credits to send - if ( out_handle.credits < flits ) return false; + if ( out_handle.credits < flits ) { + ev->takeRequest(); + delete ev; + return false; + } // Update the credits out_handle.credits -= flits;