mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-04-20 14:59:29 +00:00
Add MSCCLPP_GIT_COMMIT micro (#640)
- Add MSCCLPP_GIT_COMMIT micro - Update docs
This commit is contained in:
19
.github/workflows/update-version.yml
vendored
19
.github/workflows/update-version.yml
vendored
@@ -27,30 +27,13 @@ jobs:
|
||||
- name: Update Version in Files
|
||||
run: |
|
||||
VERSION=${{ env.VERSION }}
|
||||
sed -i "s/^version: .*/version: ${VERSION}/" CITATION.cff
|
||||
sed -i "s/^release = \".*\"/release = \"v${VERSION}\"/" docs/conf.py
|
||||
sed -i "s/^version = \".*\"/version = \"${VERSION}\"/" pyproject.toml
|
||||
|
||||
IFS='.' read -ra VER <<< "$VERSION"
|
||||
MAJOR=${VER[0]}
|
||||
MINOR=${VER[1]}
|
||||
PATCH=${VER[2]}
|
||||
|
||||
# Update CMakeLists.txt
|
||||
sed -i "s/set(MSCCLPP_MAJOR \".*\")/set(MSCCLPP_MAJOR \"${MAJOR}\")/" CMakeLists.txt
|
||||
sed -i "s/set(MSCCLPP_MINOR \".*\")/set(MSCCLPP_MINOR \"${MINOR}\")/" CMakeLists.txt
|
||||
sed -i "s/set(MSCCLPP_PATCH \".*\")/set(MSCCLPP_PATCH \"${PATCH}\")/" CMakeLists.txt
|
||||
|
||||
# Update header files
|
||||
sed -i "s/#define MSCCLPP_MAJOR .*/#define MSCCLPP_MAJOR ${MAJOR}/" include/mscclpp/core.hpp
|
||||
sed -i "s/#define MSCCLPP_MINOR .*/#define MSCCLPP_MINOR ${MINOR}/" include/mscclpp/core.hpp
|
||||
sed -i "s/#define MSCCLPP_PATCH .*/#define MSCCLPP_PATCH ${PATCH}/" include/mscclpp/core.hpp
|
||||
|
||||
- name: Commit and Push Changes
|
||||
run: |
|
||||
git config user.name "github-actions"
|
||||
git config user.email "github-actions@github.com"
|
||||
git add CITATION.cff docs/conf.py include/mscclpp/core.hpp pyproject.toml || true
|
||||
git add CITATION.cff docs/conf.py || true
|
||||
if git diff --cached --exit-code; then
|
||||
echo "No changes to commit."
|
||||
else
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
project(mscclpp LANGUAGES CXX)
|
||||
|
||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" MSCCLPP_VERSION_CONTENT)
|
||||
if(MSCCLPP_VERSION_CONTENT MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)")
|
||||
set(MSCCLPP_MAJOR "${CMAKE_MATCH_1}")
|
||||
@@ -13,8 +16,27 @@ endif()
|
||||
set(MSCCLPP_SOVERSION ${MSCCLPP_MAJOR})
|
||||
set(MSCCLPP_VERSION "${MSCCLPP_MAJOR}.${MSCCLPP_MINOR}.${MSCCLPP_PATCH}")
|
||||
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
project(mscclpp LANGUAGES CXX)
|
||||
find_package(Git)
|
||||
set(GIT_HASH "UNKNOWN")
|
||||
if(Git_FOUND)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse --short=12 HEAD
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE _git_out
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT _git_out STREQUAL "")
|
||||
set(GIT_HASH "${_git_out}")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Git not found, setting GIT_HASH to 'UNKNOWN'")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/mscclpp/version.hpp.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/include/mscclpp/version.hpp"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
|
||||
@@ -12,3 +12,4 @@ This section provides advanced topics and best practices for using MSCCL++. It i
|
||||
guide/advanced-connections
|
||||
guide/cpp-examples
|
||||
guide/mscclpp-dsl
|
||||
guide/customized-algorithm-with-nccl-api
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS *.hpp)
|
||||
target_sources(mscclpp_obj PUBLIC FILE_SET HEADERS FILES ${HEADERS})
|
||||
file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS *.hpp ${CMAKE_CURRENT_BINARY_DIR}/*.hpp)
|
||||
target_sources(
|
||||
mscclpp_obj PUBLIC FILE_SET HEADERS
|
||||
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
FILES ${HEADERS}
|
||||
)
|
||||
|
||||
@@ -4,16 +4,12 @@
|
||||
#ifndef MSCCLPP_CORE_HPP_
|
||||
#define MSCCLPP_CORE_HPP_
|
||||
|
||||
#define MSCCLPP_MAJOR 0
|
||||
#define MSCCLPP_MINOR 7
|
||||
#define MSCCLPP_PATCH 0
|
||||
#define MSCCLPP_VERSION (MSCCLPP_MAJOR * 10000 + MSCCLPP_MINOR * 100 + MSCCLPP_PATCH)
|
||||
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <mscclpp/errors.hpp>
|
||||
#include <mscclpp/version.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
13
include/mscclpp/version.hpp.in
Normal file
13
include/mscclpp/version.hpp.in
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#ifndef MSCCLPP_VERSION_HPP_
|
||||
#define MSCCLPP_VERSION_HPP_
|
||||
|
||||
#define MSCCLPP_MAJOR @MSCCLPP_MAJOR@
|
||||
#define MSCCLPP_MINOR @MSCCLPP_MINOR@
|
||||
#define MSCCLPP_PATCH @MSCCLPP_PATCH@
|
||||
#define MSCCLPP_VERSION (MSCCLPP_MAJOR * 10000 + MSCCLPP_MINOR * 100 + MSCCLPP_PATCH)
|
||||
#define MSCCLPP_GIT_COMMIT "@GIT_HASH@"
|
||||
|
||||
#endif // MSCCLPP_VERSION_HPP_
|
||||
2
python/mscclpp/.gitignore
vendored
Normal file
2
python/mscclpp/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
_version.py
|
||||
PKG-INFO
|
||||
Reference in New Issue
Block a user