Skip to content

g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 changes #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[submodule "vendor/Catch2"]
path = vendor/Catch2
url = https://github.com/catchorg/Catch2
[submodule "vendor/fmt"]
path = vendor/fmt
url = https://github.com/fmtlib/fmt
[submodule "vendor/jsoncpp"]
path = vendor/jsoncpp
url = https://github.com/open-source-parsers/jsoncpp
[submodule "vendor/libevent"]
path = vendor/libevent
url = https://github.com/libevent/libevent
[submodule "vendor/plog"]
path = vendor/plog
url = https://github.com/SergiusTheBest/plog
[submodule "vendor/yaml-cpp"]
path = vendor/yaml-cpp
url = https://github.com/jbeder/yaml-cpp
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
set (CMAKE_CUDA_ARCHITECTURES "native")
set (CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda-12.3")
set (CMAKE_CUDA_COMPILER "/usr/local/cuda-12.3/bin/nvcc")
list(APPEND LIBRARIES ${CUDA_CUBLAS_LIBRARIES})
enable_language(CUDA)

set(CUDA12_INCLUDE_DIR "/usr/local/cuda-12.3/include")
set(CUDA12_INCLUDE_DIR "/usr/local/cuda-12.3/include")
include_directories("/usr/local/cuda-12.3/targets/x86_64-linux/include")
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -312,6 +322,8 @@ add_custom_command(
)
add_custom_target(dcgm_decode_db ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dcgm_decode_db.txt)



set(DCGM_PRIVATE_DIR "${CMAKE_SOURCE_DIR}/dcgm_private")
if (EXISTS ${DCGM_PRIVATE_DIR})
add_subdirectory(${DCGM_PRIVATE_DIR})
Expand Down Expand Up @@ -447,3 +459,4 @@ configure_file(
@ONLY)

include(CPack)
cmake_minimum_required(VERSION 3.18)
20 changes: 10 additions & 10 deletions cmake/FindCuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

include(utils)

set(Cuda10_prefix usr/local/cuda-10.0)
set(Cuda11_prefix usr/local/cuda-11.8)
#set(Cuda10_prefix usr/local/cuda-10.0)
#set(Cuda11_prefix usr/local/cuda-11.8)
set(Cuda12_prefix usr/local/cuda-12.0)

macro (load_cuda cuda_version)
Expand Down Expand Up @@ -95,18 +95,18 @@ macro (load_cuda cuda_version)

endmacro()

if (NOT DEFINED CUDA10_INCLUDE_DIR AND NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
load_cuda(10)
endif()
#if (NOT DEFINED CUDA10_INCLUDE_DIR AND NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
# load_cuda(10)
#endif()

if (NOT DEFINED CUDA11_INCLUDE_DIR)
load_cuda(11)
endif()
#if (NOT DEFINED CUDA11_INCLUDE_DIR)
# load_cuda(11)
#endif()

if (NOT DEFINED CUDA12_INCLUDE_DIR)
load_cuda(12)
endif()

unset(Cuda10_prefix)
unset(Cuda11_prefix)
#unset(Cuda10_prefix)
#unset(Cuda11_prefix)
unset(Cuda12_prefix)
4 changes: 2 additions & 2 deletions cmake/FindJsoncpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

if (NOT TARGET JsonCpp::JsonCpp)
find_package(jsoncpp REQUIRED CONFIG)
set(JSONCPP_STATIC_LIBS jsoncpp_static)
set(JSONCPP_INCLUDE_PATH $<TARGET_PROPERTY:jsoncpp_static,INTERFACE_INCLUDE_DIRECTORIES>)
set(JSONCPP_STATIC_LIBS jsoncpp)
set(JSONCPP_INCLUDE_PATH $<TARGET_PROPERTY:jsoncpp,INTERFACE_INCLUDE_DIRECTORIES>)
endif()
# set(Jsoncpp_PATH_PREFIXES /usr/local "${Jsoncpp_ROOT}" "$ENV{HOME}")
# foreach(prefix ${Jsoncpp_PATH_PREFIXES})
Expand Down
69 changes: 13 additions & 56 deletions cmake/FindLibevent.cmake
Original file line number Diff line number Diff line change
@@ -1,61 +1,18 @@
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# - Find Libevent (a cross event library)
# This module defines
# LIBEVENT_INCLUDE_DIR, where to find Libevent headers
# LIBEVENT_STATIC_LIBS, Libevent static libraries
# Libevent_FOUND, If false, do not try to use libevent
include(FindPackageHandleStandardArgs)

set(Libevent_EXTRA_PREFIXES / /lib /lib64 /usr/local /opt/local "$ENV{HOME}" "${Libevent_ROOT}")
foreach(prefix ${Libevent_EXTRA_PREFIXES})
list(APPEND Libevent_INCLUDE_PATHS "${prefix}/include")
list(APPEND Libevent_LIB_PATHS "${prefix}/lib" "${prefix}/lib64")
endforeach()
find_library(LIBEVENT_LIBRARY event
PATHS ${LIBEVENT_LIBRARYDIR})

find_path(LIBEVENT_INCLUDE_DIR evhttp.h event.h PATHS ${Libevent_INCLUDE_PATHS})
find_library(LIBEVENT_STATIC_LIB NAMES libevent.a libevent_core.a libevent_extra.a PATHS ${Libevent_LIB_PATHS})
find_library(LIBEVENT_PTHREAD_STATIC_LIB NAMES libevent_pthreads.a PATHS ${Libevent_LIB_PATHS})
find_path(LIBEVENT_INCLUDE_DIR event.h
PATHS ${LIBEVENT_INCLUDEDIR})

if (LIBEVENT_INCLUDE_DIR AND LIBEVENT_STATIC_LIB AND LIBEVENT_PTHREAD_STATIC_LIB)
set(Libevent_FOUND TRUE)
add_library(libevent_event_static STATIC IMPORTED)
set_target_properties(libevent_event_static PROPERTIES IMPORTED_LOCATION ${LIBEVENT_STATIC_LIB})
add_library(libevent_event_pthread STATIC IMPORTED)
set_target_properties(libevent_event_pthread PROPERTIES IMPORTED_LOCATION ${LIBEVENT_PTHREAD_STATIC_LIB})
set(LIBEVENT_STATIC_LIBS libevent_event_static libevent_event_pthread)
else ()
set(Libevent_FOUND FALSE)
endif ()

if (Libevent_FOUND)
if (NOT Libevent_FIND_QUIETLY)
message(STATUS "Found libevent: ${LIBEVENT_LIB}")
endif ()
else ()
if (Libevent_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find libevent and libevent_pthread.")
endif ()
message(STATUS "libevent and libevent_pthread NOT found.")
endif ()

unset(Libevent_EXTRA_PREFIXES)
unset(LIBEVENT_PTHREAD_STATIC_LIB)
unset(LIBEVENT_STATIC_LIB)
find_package_handle_standard_args(libevent DEFAULT_MSG
LIBEVENT_LIBRARY
LIBEVENT_INCLUDE_DIR)

mark_as_advanced(
LIBEVENT_STATIC_LIBS
LIBEVENT_INCLUDE_DIR
)
LIBEVENT_LIBRARY
LIBEVENT_INCLUDE_DIR)

set(LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARY})
set(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
6 changes: 6 additions & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ target_link_libraries(dcgm_common PUBLIC
sdk_nvml_essentials_objects
fmt::fmt
dl

)
target_link_libraries(dcgm_common PRIVATE "/usr/local/lib/libevent.so")
target_link_libraries(dcgm_common PRIVATE "/usr/local/lib/libevent_pthreads.so")


add_library(common_watch_objects STATIC)
target_sources(common_watch_objects PRIVATE
Expand All @@ -97,3 +101,5 @@ target_sources(common_watch_objects PRIVATE
DcgmWatchTable.h
)
target_link_libraries(common_watch_objects PUBLIC common_interface)


18 changes: 9 additions & 9 deletions common/CudaWorker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ macro(define_dcgm_cuda_worker cuda_version)
CudaWorkerThread.hpp
)

if (${cuda_version} GREATER 10)
# if (${cuda_version} GREATER 10)
target_sources(${dcgm_cuda_worker_lib} PRIVATE DcgmDgemm.cpp)
else()
target_compile_options(${dcgm_cuda_worker_lib} PRIVATE -Wno-volatile)
endif()
#else()
# target_compile_options(${dcgm_cuda_worker_lib} PRIVATE -Wno-volatile)
#endif()

set(LOCAL_DCGM_CUDA_WORKER "${LOCAL_DCGM_CUDA_WORKER};${dcgm_cuda_worker_lib}" PARENT_SCOPE)
endmacro()

set(LOCAL_DCGM_CUDA_WORKER "")

if (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
define_dcgm_cuda_worker(10)
endif()
define_dcgm_cuda_worker(11)
#if (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
# define_dcgm_cuda_worker(10)
#endif()
#define_dcgm_cuda_worker(11)
define_dcgm_cuda_worker(12)

set(DCGM_CUDA_WORKER ${LOCAL_DCGM_CUDA_WORKER} PARENT_SCOPE)
set(DCGM_CUDA_WORKER ${LOCAL_DCGM_CUDA_WORKER} PARENT_SCOPE)
7 changes: 7 additions & 0 deletions common/CudaWorker/CudaWorkerThread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@

#include <chrono>


inline int format_as(cudaError_enum type) {
return static_cast<int>(type);
}



#include "FieldWorkers.hpp"
#include <DcgmTaskRunner.h>

Expand Down
7 changes: 6 additions & 1 deletion common/CudaWorker/FieldWorkers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@
*/
#pragma once

#include <cublas_proxy.hpp>
//#include <cublas_proxy.hpp>
#include "../cublas_proxy/cublas_proxy.hpp"
#include <cuda.h>

#if (CUDA_VERSION_USED >= 11)
#include "DcgmDgemm.hpp"
#endif

#include <DcgmLogging.h>

#include <fmt/format.h>
#include <timelib.h>
inline int format_as(cublasStatus_t type) {
return static_cast<int>(type);
}

using namespace Dcgm;

Expand Down
2 changes: 1 addition & 1 deletion common/DcgmLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <mutex>
#include <string>
#include <syslog.h>

#include "format.hpp" // now define formatting for classes in this module
#define DCGM_LOGGING_SEVERITY_OPTIONS "NONE, FATAL, ERROR, WARN, INFO, DEBUG, VERB"

#define DCGM_LOGGING_SEVERITY_STRING_VERBOSE "VERB"
Expand Down
2 changes: 2 additions & 0 deletions common/DcgmMutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <chrono>
#include <ratio>

inline int format_as(dcgmMutexSt type) { return static_cast<int>(type);}

/*****************************************************************************/
DcgmMutex::DcgmMutex(int timeoutMs)
// Cast to long long to avoid overflowing before widening to a long long
Expand Down
2 changes: 1 addition & 1 deletion common/DcgmWatchTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "DcgmLogging.h"
#include "DcgmUtilities.h"
#include "DcgmWatchTable.h"

inline int format_as(DcgmWatcherType_t type) { return static_cast<int>(type);}
/*****************************************************************************/
DcgmWatchTable::DcgmWatchTable()
: m_entityWatchHashTable()
Expand Down
4 changes: 2 additions & 2 deletions common/tests/TaskRunnerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ TEST_CASE("TaskRunner: Limited Queue")

tr.Stop();
fmt::print("Wait iterations elapsed: {}\n", cWaitIterations - waitIterations);
fmt::print("Iterations: {}\nExecutions: {}\nFailed to add: {}\n", iterations, executed, failedToAdd);
fmt::print("Iterations: {}\nExecutions: {}\nFailed to add: {}\n", (int)iterations, (int)executed, (int)failedToAdd);
REQUIRE(executed >= cTaskRunnerCapacity);
REQUIRE((failedToAdd + executed) == iterations);
}
Expand All @@ -310,4 +310,4 @@ TEST_CASE("TaskRunner: Task with attempts")
REQUIRE(fut.has_value());
REQUIRE_THROWS_AS((*fut).get(), std::future_error);
tr.Stop();
}
}
20 changes: 13 additions & 7 deletions cublas_proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,30 @@ macro(define_proxy_lib CUDA_VER)
set(cublas_proxy_include_dir "${CMAKE_CURRENT_SOURCE_DIR}/..")
get_absolute_path(${cublas_proxy_include_dir} cublas_proxy_include_dir)
target_include_directories(${lib_name} PUBLIC $<BUILD_INTERFACE:${cublas_proxy_include_dir}>)

target_include_directories(${lib_name} PUBLIC $<BUILD_INTERFACE:${CUDA${CUDA_VER}_INCLUDE_DIR}>)
target_link_libraries(${lib_name} PRIVATE dl rt)
target_link_libraries(${lib_name} PRIVATE dcgm dcgm_common dcgm_logging dcgm_mutex)
target_link_libraries(${lib_name} PRIVATE ${CUDA${CUDA_VER}_STATIC_CUBLAS_LIBS})
target_link_libraries(${lib_name} PRIVATE ${CUDA${CUDA_VER}_STATIC_LIBS})
target_link_libraries(${lib_name} PRIVATE ${CUDA${CUDA_VER}_LIBS})
# target_link_libraries(${lib_name} PRIVATE ${CUDA${CUDA_VER}_STATIC_CUBLAS_LIBS})
# target_link_libraries(${lib_name} PRIVATE ${CUDA${CUDA_VER}_STATIC_LIBS})
# target_link_libraries(${lib_name} PRIVATE ${CUDA_CUBLAS_LIBRARIES}))
#set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS}
target_link_libraries(${lib_name} PRIVATE "/usr/local/cuda-12.3/lib64/libcublas.so" )
target_link_libraries(${lib_name} PRIVATE "/usr/local/cuda-12.3/targets/x86_64-linux/lib/libcublasLt.so" )


set(LOCAL_CUBLAS_PROXY "${LOCAL_CUBLAS_PROXY};${lib_name}" PARENT_SCOPE)


endmacro()

set(LOCAL_CUBLAS_PROXY "")

add_subdirectory(Cuda12)
add_subdirectory(Cuda11)
if (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
add_subdirectory(Cuda10)
endif()
#add_subdirectory(Cuda11)
#if (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
# add_subdirectory(Cuda10)
#endif()

set(DCGM_CUBLAS_PROXY ${LOCAL_CUBLAS_PROXY} PARENT_SCOPE)

4 changes: 2 additions & 2 deletions cublas_proxy/Cuda10/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
define_proxy_lib(10)
target_compile_options(${lib_name} PRIVATE -Wno-volatile)
#define_proxy_lib(10)
#target_compile_options(${lib_name} PRIVATE -Wno-volatile)
2 changes: 1 addition & 1 deletion cublas_proxy/Cuda11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
define_proxy_lib(11)
#define_proxy_lib(11)
30 changes: 30 additions & 0 deletions dcgmlib/format.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef DCGM_FORMAT_H
#define DCGM_FORMAT_H
#ifdef DcgmWatcherType_t
inline int format_as(DcgmWatcherType_t type) { return static_cast<int>(type);}
#endif
inline int format_as(dcgmChipArchitecture_enum type) { return static_cast<int>(type);}
inline int format_as(dcgmConfigType_enum type) { return static_cast<int>(type);}
inline int format_as(dcgmDiagnosticLevel_t type) { return static_cast<int>(type);}

inline int format_as(dcgmGroupType_enum type) { return static_cast<int>(type);}
inline int format_as(dcgmHealthSystems_enum type) { return static_cast<int>(type);}
inline int format_as(dcgmModuleId_t type) { return static_cast<int>(type);}
inline int format_as(dcgmModuleStatus_t type) { return static_cast<int>(type);}
//inline int format_as(dcgmMutexSt type) { return static_cast<int>(type);}

#ifdef dcgmNvLinkLinkState
inline int format_as(dcgmNvLinkLinkState type) { return static_cast<int>(type);}
#endif
inline int format_as(dcgmOrder_enum type) { return static_cast<int>(type);}
inline int format_as(dcgmPolicyCondition_enum type) { return static_cast<int>(type);}
inline int format_as(dcgmPolicyValidation_enum type) { return static_cast<int>(type);}
inline int format_as(dcgmPolicyAction_enum type) { return static_cast<int>(type);}

inline int format_as(dcgmReturn_enum type) { return static_cast<int>(type);}
inline int format_as(dcgm_field_entity_group_t type) { return static_cast<int>(type);}

#ifdef nvmlReturn_enum
inline int format_as(nvmlReturn_enum type) { return static_cast<int>(type);}
#endif
#endif
Loading