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

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

**Note**: This requires:
- CUDA toolkit (compatible with your GPU driver)
Expand Down
16 changes: 10 additions & 6 deletions infinibench/hardware/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Hardware Benchmarks

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

## Platforms

Expand All @@ -13,6 +13,7 @@ names are kept unchanged.
| 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` |

Run each build command from its benchmark directory. All binaries use the same
test selectors and common arguments:
Expand Down Expand Up @@ -44,9 +45,10 @@ example, Moore Threads STREAM uses:
}
```

The aliases `nvidia`, `musa`, and `mthreads` are also accepted as explicit
device values. A selected non-CUDA platform is recorded in the result
configuration as `platform`; metric names remain compatible with CUDA results.
The aliases `nvidia`, `musa`, `mthreads`, and `mlu` are also accepted as
explicit device values. A selected non-CUDA platform is recorded in the result
configuration as `platform`. Cambricon NRAM bandwidth is published as
`hardware.nram_bandwidth`; it is not relabeled as a CUDA L1 cache metric.

## Device Visibility

Expand All @@ -58,12 +60,14 @@ 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` |

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
```

## Container Notes
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