From d59fb646f7b16315afb6534abf0efc9d72c0176a Mon Sep 17 00:00:00 2001 From: Vivek Kale Date: Thu, 20 Jul 2023 21:05:20 -0700 Subject: [PATCH] fully removed nvprof-focused-connector directory --- .../nvprof-focused-connector/CMakeLists.txt | 4 - profiling/nvprof-focused-connector/Makefile | 18 --- .../kp_nvprof_focused_connector.cpp | 152 ------------------ .../kp_nvprof_focused_connector_domain.h | 84 ---------- 4 files changed, 258 deletions(-) delete mode 100644 profiling/nvprof-focused-connector/CMakeLists.txt delete mode 100644 profiling/nvprof-focused-connector/Makefile delete mode 100644 profiling/nvprof-focused-connector/kp_nvprof_focused_connector.cpp delete mode 100644 profiling/nvprof-focused-connector/kp_nvprof_focused_connector_domain.h diff --git a/profiling/nvprof-focused-connector/CMakeLists.txt b/profiling/nvprof-focused-connector/CMakeLists.txt deleted file mode 100644 index 072198bf5..000000000 --- a/profiling/nvprof-focused-connector/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -find_package(CUDAToolkit REQUIRED) -kp_add_library(kp_nvprof_focused_connector kp_nvprof_focused_connector.cpp) - -target_link_libraries(kp_nvprof_focused_connector CUDA::nvToolsExt) \ No newline at end of file diff --git a/profiling/nvprof-focused-connector/Makefile b/profiling/nvprof-focused-connector/Makefile deleted file mode 100644 index 06628279d..000000000 --- a/profiling/nvprof-focused-connector/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -CXX=g++ -CXXFLAGS=-O3 -std=c++11 -g -I$(CUDA_ROOT)/include -I./ -LDFLAGS=-L$(CUDA_ROOT)/lib64 -LIBS=-lnvToolsExt -lcudart -SHARED_CXXFLAGS=-shared -fPIC - -all: kp_nvprof_focused_connector.so - -MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) - -CXXFLAGS+=-I${MAKEFILE_PATH} -I${MAKEFILE_PATH}/../../common/makefile-only -I${MAKEFILE_PATH}../all - -kp_nvprof_focused_connector.so: ${MAKEFILE_PATH}kp_nvprof_focused_connector.cpp - $(CXX) $(SHARED_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) \ - -o $@ ${MAKEFILE_PATH}kp_nvprof_focused_connector.cpp $(LIBS) - -clean: - rm *.so diff --git a/profiling/nvprof-focused-connector/kp_nvprof_focused_connector.cpp b/profiling/nvprof-focused-connector/kp_nvprof_focused_connector.cpp deleted file mode 100644 index dba824257..000000000 --- a/profiling/nvprof-focused-connector/kp_nvprof_focused_connector.cpp +++ /dev/null @@ -1,152 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "kp_nvprof_focused_connector_domain.h" - -#include "kp_core.hpp" - -namespace KokkosTools { -namespace NVProfFocusedConnector { - -static KernelNVProfFocusedConnectorInfo* currentKernel; -static std::unordered_map - domain_map; -static uint64_t nextKernelID; - -void kokkosp_init_library( - const int loadSeq, const uint64_t interfaceVer, const uint32_t devInfoCount, - struct Kokkos_Profiling_KokkosPDeviceInfo* deviceInfo) { - printf("-----------------------------------------------------------\n"); - printf( - "KokkosP: NVProf Analyzer Focused Connector (sequence is %d, version: " - "%llu)\n", - loadSeq, interfaceVer); - printf("-----------------------------------------------------------\n"); - - nextKernelID = 0; -} - -KernelNVProfFocusedConnectorInfo* getFocusedConnectorInfo( - const char* name, KernelExecutionType kType) { - std::string nameStr(name); - auto kDomain = domain_map.find(nameStr); - currentKernel = NULL; - - if (kDomain == domain_map.end()) { - currentKernel = new KernelNVProfFocusedConnectorInfo(name, kType); - domain_map.insert(std::pair( - nameStr, currentKernel)); - } else { - currentKernel = kDomain->second; - } - - return currentKernel; -} - -void focusedConnectorExecuteStart() { - cudaProfilerStart(); - currentKernel->startRange(); -} - -void focusedConnectorExecuteEnd() { - currentKernel->endRange(); - cudaProfilerStop(); - currentKernel = NULL; -} - -void kokkosp_finalize_library() { - printf("-----------------------------------------------------------\n"); - printf("KokkosP: Finalization of NVProf Connector. Complete.\n"); - printf("-----------------------------------------------------------\n"); -} - -void kokkosp_begin_parallel_for(const char* name, const uint32_t devID, - uint64_t* kID) { - *kID = nextKernelID++; - - currentKernel = getFocusedConnectorInfo(name, PARALLEL_FOR); - focusedConnectorExecuteStart(); -} - -void kokkosp_end_parallel_for(const uint64_t kID) { - focusedConnectorExecuteEnd(); -} - -void kokkosp_begin_parallel_scan(const char* name, const uint32_t devID, - uint64_t* kID) { - *kID = nextKernelID++; - - currentKernel = getFocusedConnectorInfo(name, PARALLEL_SCAN); - focusedConnectorExecuteStart(); -} - -void kokkosp_end_parallel_scan(const uint64_t kID) { - focusedConnectorExecuteEnd(); -} - -void kokkosp_begin_parallel_reduce(const char* name, const uint32_t devID, - uint64_t* kID) { - *kID = nextKernelID++; - - currentKernel = getFocusedConnectorInfo(name, PARALLEL_REDUCE); - focusedConnectorExecuteStart(); -} - -void kokkosp_end_parallel_reduce(const uint64_t kID) { - focusedConnectorExecuteEnd(); -} - -Kokkos::Tools::Experimental::EventSet get_event_set() { - Kokkos::Tools::Experimental::EventSet my_event_set; - memset(&my_event_set, 0, - sizeof(my_event_set)); // zero any pointers not set here - my_event_set.init = kokkosp_init_library; - my_event_set.finalize = kokkosp_finalize_library; - my_event_set.begin_parallel_for = kokkosp_begin_parallel_for; - my_event_set.begin_parallel_reduce = kokkosp_begin_parallel_reduce; - my_event_set.begin_parallel_scan = kokkosp_begin_parallel_scan; - my_event_set.end_parallel_for = kokkosp_end_parallel_for; - my_event_set.end_parallel_reduce = kokkosp_end_parallel_reduce; - my_event_set.end_parallel_scan = kokkosp_end_parallel_scan; - return my_event_set; -} - -} // namespace NVProfFocusedConnector -} // namespace KokkosTools - -extern "C" { - -namespace impl = KokkosTools::NVProfFocusedConnector; - -EXPOSE_INIT(impl::kokkosp_init_library) -EXPOSE_FINALIZE(impl::kokkosp_finalize_library) -EXPOSE_BEGIN_PARALLEL_FOR(impl::kokkosp_begin_parallel_for) -EXPOSE_END_PARALLEL_FOR(impl::kokkosp_end_parallel_for) -EXPOSE_BEGIN_PARALLEL_SCAN(impl::kokkosp_begin_parallel_scan) -EXPOSE_END_PARALLEL_SCAN(impl::kokkosp_end_parallel_scan) -EXPOSE_BEGIN_PARALLEL_REDUCE(impl::kokkosp_begin_parallel_reduce) -EXPOSE_END_PARALLEL_REDUCE(impl::kokkosp_end_parallel_reduce) - -} // extern "C" diff --git a/profiling/nvprof-focused-connector/kp_nvprof_focused_connector_domain.h b/profiling/nvprof-focused-connector/kp_nvprof_focused_connector_domain.h deleted file mode 100644 index dc2d3cabb..000000000 --- a/profiling/nvprof-focused-connector/kp_nvprof_focused_connector_domain.h +++ /dev/null @@ -1,84 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#ifndef _H_KOKKOSP_KERNEL_NVPROF_CONNECTOR_INFO -#define _H_KOKKOSP_KERNEL_NVPROF_CONNECTOR_INFO - -#include -#include -#include - -#include "nvToolsExt.h" - -namespace KokkosTools { -namespace NVProfFocusedConnector { - -enum KernelExecutionType { - PARALLEL_FOR = 0, - PARALLEL_REDUCE = 1, - PARALLEL_SCAN = 2 -}; - -class KernelNVProfFocusedConnectorInfo { - public: - KernelNVProfFocusedConnectorInfo(std::string kName, - KernelExecutionType kernelType) { - domainNameHandle = kName; - char* domainName = (char*)malloc(sizeof(char*) * (32 + kName.size())); - - if (kernelType == PARALLEL_FOR) { - sprintf(domainName, "ParallelFor.%s", kName.c_str()); - } else if (kernelType == PARALLEL_REDUCE) { - sprintf(domainName, "ParallelReduce.%s", kName.c_str()); - } else if (kernelType == PARALLEL_SCAN) { - sprintf(domainName, "ParallelScan.%s", kName.c_str()); - } else { - sprintf(domainName, "Kernel.%s", kName.c_str()); - } - - domain = nvtxDomainCreateA(domainName); - currentRange = 0; - } - - nvtxRangeId_t startRange() { - nvtxEventAttributes_t eventAttrib = {0}; - eventAttrib.version = NVTX_VERSION; - eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; - eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; - eventAttrib.message.ascii = "my range"; - currentRange = nvtxDomainRangeStartEx(domain, &eventAttrib); - return currentRange; - } - - nvtxRangeId_t getCurrentRange() { return currentRange; } - - void endRange() { nvtxDomainRangeEnd(domain, currentRange); } - - nvtxDomainHandle_t getDomain() { return domain; } - - std::string getDomainNameHandle() { return domainNameHandle; } - - ~KernelNVProfFocusedConnectorInfo() { nvtxDomainDestroy(domain); } - - private: - std::string domainNameHandle; - nvtxRangeId_t currentRange; - nvtxDomainHandle_t domain; -}; - -#endif -} -} // KokkosTools::NVProfFocusedConnector