Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cd infinibench/hardware/cuda-memory-benchmark
bash build.sh --platform cuda
```

For MetaX, Iluvatar, Hygon, Moore Threads, and Ascend build and runtime
For MetaX, Iluvatar, Hygon, Moore Threads, Cambricon, and Ascend build and runtime
instructions, see [Hardware Benchmarks](../infinibench/hardware/README.md).

**Note**: This requires:
Expand Down
11 changes: 8 additions & 3 deletions infinibench/hardware/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hardware Benchmarks

InfiniBench provides one hardware adapter for NVIDIA CUDA and five additional
InfiniBench provides one hardware adapter for NVIDIA CUDA and six additional
accelerator platforms. Existing CUDA command shapes, behavior, and metric names
are kept unchanged. Platform-specific tests use distinct metric names.

Expand All @@ -13,6 +13,7 @@ are kept unchanged. Platform-specific tests use distinct metric names.
| Iluvatar CoreX | `corex`, `iluvatar` | `bash build.sh --platform corex` | `cuda-memory-benchmark/build/cuda_perf_suite` |
| Hygon DCU | `hygon` | `bash build.sh --platform hygon` | `cuda-memory-benchmark/build/cuda_perf_suite` |
| Moore Threads | `moore` | `bash build.sh --platform moore` | `cuda-memory-benchmark/build/cuda_perf_suite` |
| Cambricon | `cambricon`, `mlu` | `bash build.sh` | `cambricon-memory-benchmark/build/mlu_perf_suite` |
| Ascend | `ascend`, `npu` | `bash build.sh` | `ascend-memory-benchmark/build/npu_perf_suite` |

Run each build command from its benchmark directory. All binaries use the same
Expand Down Expand Up @@ -45,9 +46,11 @@ example, Moore Threads STREAM uses:
}
```

The aliases `nvidia`, `musa`, `mthreads`, and `npu` are also accepted as
The aliases `nvidia`, `musa`, `mthreads`, `mlu`, and `npu` are also accepted as
explicit device values. A selected non-CUDA platform is recorded in the result
configuration as `platform`. Ascend publishes all four STREAM operations: Copy
configuration as `platform`. Cambricon NRAM bandwidth is published as
`hardware.nram_bandwidth`; it is not relabeled as a CUDA L1 cache metric.
Ascend publishes all four STREAM operations: Copy
uses ACL D2D memcpy, Scale uses `aclnnMuls`, and Add/Triad use `aclnnAdd` with
the corresponding scalar. Its ACL D2D memcpy size sweep is published as
`hardware.d2d_memcpy_size_sweep` and does not claim to isolate AI Core memory
Expand All @@ -63,13 +66,15 @@ The selected physical device is renumbered to device 0 inside the process.
| NVIDIA, MetaX, Iluvatar | `CUDA_VISIBLE_DEVICES` |
| Hygon | `HIP_VISIBLE_DEVICES` and `ROCR_VISIBLE_DEVICES` |
| Moore Threads | `MUSA_VISIBLE_DEVICES` |
| Cambricon | `MLU_VISIBLE_DEVICES` |
| Ascend | `ASCEND_RT_VISIBLE_DEVICES` |

For example:

```bash
CUDA_VISIBLE_DEVICES=2 ./build/cuda_perf_suite --stream --device 0
MUSA_VISIBLE_DEVICES=0 ./build/cuda_perf_suite --stream --device 0
MLU_VISIBLE_DEVICES=3 ./build/mlu_perf_suite --stream --device 0
ASCEND_RT_VISIBLE_DEVICES=4 ./build/npu_perf_suite --stream --device 0
```

Expand Down
65 changes: 65 additions & 0 deletions infinibench/hardware/cambricon-memory-benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 3.18)

# Find NEUWARE / CNToolkit
if(DEFINED ENV{NEUWARE_HOME})
set(NEUWARE_HOME $ENV{NEUWARE_HOME})
else()
set(NEUWARE_HOME "/usr/local/neuware")
endif()
message(STATUS "NEUWARE_HOME: ${NEUWARE_HOME}")

# Find cncc compiler (used as C++ compiler for Cambricon)
find_program(CNCC cncc HINTS ${NEUWARE_HOME}/bin)
if(NOT CNCC)
message(FATAL_ERROR "cncc not found. Set NEUWARE_HOME.")
endif()
message(STATUS "Found cncc: ${CNCC}")

set(CMAKE_CXX_COMPILER "${CNCC}")
project(MluPerfSuite VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if(DEFINED ENV{MLU_ARCH})
set(MLU_ARCH $ENV{MLU_ARCH})
else()
set(MLU_ARCH "mtp_592")
endif()

# Find CNRT library
find_library(CNRT_LIB cnrt HINTS ${NEUWARE_HOME}/lib64 ${NEUWARE_HOME}/lib)
if(NOT CNRT_LIB)
message(FATAL_ERROR "libcnrt not found in ${NEUWARE_HOME}")
endif()

# Find CNRT headers
find_path(CNRT_INCLUDE_DIR NAMES cnrt.h HINTS ${NEUWARE_HOME}/include)
if(NOT CNRT_INCLUDE_DIR)
message(FATAL_ERROR "cnrt.h not found in ${NEUWARE_HOME}/include")
endif()

add_executable(mlu_perf_suite src/main.mlu)
target_include_directories(mlu_perf_suite PRIVATE
${CNRT_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_compile_options(mlu_perf_suite PRIVATE "--bang-mlu-arch=${MLU_ARCH}")
target_link_libraries(mlu_perf_suite ${CNRT_LIB} stdc++ m pthread)

set_source_files_properties(src/main.mlu PROPERTIES LANGUAGE CXX)

install(TARGETS mlu_perf_suite RUNTIME DESTINATION bin)

message(STATUS "")
message(STATUS "Configuration Summary:")
message(STATUS " Project: ${PROJECT_NAME} v${PROJECT_VERSION}")
message(STATUS " Build: ${CMAKE_BUILD_TYPE}")
message(STATUS " cncc: ${CNCC}")
message(STATUS " MLU arch: ${MLU_ARCH}")
message(STATUS " CNRT: ${CNRT_LIB}")
message(STATUS "")
54 changes: 54 additions & 0 deletions infinibench/hardware/cambricon-memory-benchmark/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -e

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

echo "=========================================="
echo " MLU Performance Suite - Build Script"
echo "=========================================="
echo ""

if ! command -v cncc &> /dev/null; then
echo -e "${RED}ERROR: cncc not found. Install CNToolkit.${NC}"
exit 1
fi

if [ -z "${NEUWARE_HOME}" ]; then
export NEUWARE_HOME="/usr/local/neuware"
fi

# MLU architecture - must be set for device kernel compilation
if [ -z "${MLU_ARCH}" ]; then
MLU_ARCH="mtp_592"
fi

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="${SCRIPT_DIR}/build"

mkdir -p "${BUILD_DIR}"

echo -e "${YELLOW}Compiling (arch=${MLU_ARCH})...${NC}"
cncc "${SCRIPT_DIR}/src/main.mlu" \
-o "${BUILD_DIR}/mlu_perf_suite" \
-O3 -std=c++17 \
--bang-mlu-arch="${MLU_ARCH}" \
-I"${NEUWARE_HOME}/include" \
-I"${SCRIPT_DIR}/include" \
-L"${NEUWARE_HOME}/lib64" \
-lcnrt -lstdc++ -lm

echo ""
echo -e "${GREEN}Build succeeded!${NC}"
echo ""
echo "Executable: ${BUILD_DIR}/mlu_perf_suite"
echo ""
echo "Usage:"
echo " ${BUILD_DIR}/mlu_perf_suite --all"
echo " ${BUILD_DIR}/mlu_perf_suite --memory"
echo " ${BUILD_DIR}/mlu_perf_suite --stream"
echo " ${BUILD_DIR}/mlu_perf_suite --cache"
echo " MLU_ARCH=mtp_592 ./build.sh # override arch"
echo ""
Loading
Loading