chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
# Debug Build Scripts
|
||||
|
||||
This directory contains specialized build scripts for debugging various aspects of libnd4j. Each script is configured with specific debug flags for different debugging scenarios.
|
||||
|
||||
## Available Scripts
|
||||
|
||||
### CPU Backend Scripts
|
||||
|
||||
1. **build-cpu-backend-full-debug.sh**
|
||||
- Full debug build with all debug flags enabled
|
||||
- Includes calltrace, printmath, printindices, and address sanitizer
|
||||
- Best for comprehensive debugging of CPU issues
|
||||
|
||||
2. **build-cpu-backend-preprocessor-debug.sh**
|
||||
- Enables preprocessor output for macro debugging
|
||||
- Useful for investigating template and macro expansion issues
|
||||
|
||||
3. **build-cpu-backend-valgrind-debug.sh**
|
||||
- Optimized for Valgrind analysis
|
||||
- Includes memory leak detection and call tracing
|
||||
- Disables optimizations for better debugging
|
||||
|
||||
4. **build-cpu-backend-onednn-debug.sh**
|
||||
- Debug build with OneDNN support
|
||||
- Includes all debug flags
|
||||
- Useful for OneDNN-specific issues
|
||||
|
||||
### CUDA Backend Scripts
|
||||
|
||||
1. **build-cuda-backend-full-debug.sh**
|
||||
- Full debug build for CUDA with all debug flags
|
||||
- Includes NVCC output preservation
|
||||
- Best for comprehensive debugging of CUDA issues
|
||||
|
||||
2. **build-cuda-backend-compute-sanitizer.sh**
|
||||
- Optimized for NVIDIA Compute Sanitizer
|
||||
- Includes debug symbols and reduced optimization
|
||||
- Best for CUDA memory and race condition debugging
|
||||
|
||||
## Usage Notes
|
||||
|
||||
1. **General Debug Builds**
|
||||
```bash
|
||||
# For CPU debugging
|
||||
./build-cpu-backend-full-debug.sh
|
||||
|
||||
# For CUDA debugging
|
||||
./build-cuda-backend-full-debug.sh
|
||||
```
|
||||
|
||||
2. **Macro Debugging**
|
||||
```bash
|
||||
./build-cpu-backend-preprocessor-debug.sh
|
||||
# Check preprocessed files in the preprocessed/ directory
|
||||
```
|
||||
|
||||
3. **Memory Analysis**
|
||||
```bash
|
||||
# For CPU with Valgrind
|
||||
./build-cpu-backend-valgrind-debug.sh
|
||||
|
||||
# For CUDA with Compute Sanitizer
|
||||
./build-cuda-backend-compute-sanitizer.sh
|
||||
```
|
||||
|
||||
## Flag Combinations
|
||||
|
||||
The scripts use various combinations of these debug flags:
|
||||
|
||||
- `libnd4j.build=debug`: Enables debug symbols
|
||||
- `libnd4j.calltrace=ON`: Enables function call tracing
|
||||
- `libnd4j.printmath=ON`: Prints math operations
|
||||
- `libnd4j.printindices=ON`: Prints array indices
|
||||
- `libnd4j.sanitize=ON`: Enables sanitizer support
|
||||
- `libnd4j.preprocess=ON`: Enables preprocessor output
|
||||
- `libnd4j.keepnvcc=ON`: Preserves NVCC output (CUDA)
|
||||
|
||||
## Important Notes
|
||||
|
||||
1. Debug builds are significantly slower than release builds
|
||||
2. Some flag combinations may be incompatible (e.g., different sanitizers)
|
||||
3. Ensure sufficient disk space for debug symbols and preprocessor output
|
||||
4. CUDA debugging requires appropriate NVIDIA tools installation
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Full debug build for CPU backend with all debug flags enabled
|
||||
|
||||
cd ..
|
||||
mvn -Pcpu clean install -DskipTests \
|
||||
-Dlibnd4j.build=debug \
|
||||
-Dlibnd4j.calltrace=ON \
|
||||
-Dlibnd4j.printmath=ON \
|
||||
-Dlibnd4j.printindices=ON \
|
||||
-Dlibnd4j.sanitize=ON \
|
||||
-Dlibnd4j.sanitizers="address,undefined,float-divide-by-zero,float-cast-overflow" \
|
||||
-pl :libnd4j,:nd4j-native-preset,:nd4j-native
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Full debug build for CPU backend with OneDNN and debug flags enabled
|
||||
|
||||
cd ..
|
||||
mvn -Pcpu clean install -DskipTests \
|
||||
-Dlibnd4j.helper=onednn \
|
||||
-Dlibnd4j.build=debug \
|
||||
-Dlibnd4j.calltrace=ON \
|
||||
-Dlibnd4j.printmath=ON \
|
||||
-Dlibnd4j.printindices=ON \
|
||||
-Dlibnd4j.sanitize=ON \
|
||||
-Dlibnd4j.sanitizers="address,undefined,float-divide-by-zero,float-cast-overflow" \
|
||||
-pl :libnd4j,:nd4j-native-preset,:nd4j-native
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# CPU backend build with preprocessor output for macro debugging
|
||||
|
||||
cd ..
|
||||
mvn -Pcpu clean install -DskipTests \
|
||||
-Dlibnd4j.build=debug \
|
||||
-Dlibnd4j.preprocess=ON \
|
||||
-pl :libnd4j,:nd4j-native-preset,:nd4j-native
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
# CPU backend build optimized for Valgrind analysis
|
||||
|
||||
cd ..
|
||||
mvn -Pcpu clean install -DskipTests \
|
||||
-Dlibnd4j.build=debug \
|
||||
-Dlibnd4j.calltrace=ON \
|
||||
-Dlibnd4j.optimization=0 \
|
||||
-Dtest.prefix="valgrind --tool=memcheck --track-origins=yes --leak-check=full" \
|
||||
-pl :libnd4j,:nd4j-native-preset,:nd4j-native
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# CUDA backend build optimized for Compute Sanitizer analysis
|
||||
|
||||
cd ..
|
||||
mvn -Pcuda -Dlibnd4j.chip=cuda clean install -DskipTests \
|
||||
-Dlibnd4j.build=debug \
|
||||
-Dlibnd4j.calltrace=ON \
|
||||
-Dlibnd4j.keepnvcc=ON \
|
||||
-Dlibnd4j.optimization=0 \
|
||||
-Dtest.runner="compute-sanitizer --tool memcheck" \
|
||||
-pl :libnd4j,:nd4j-cuda-12.1-preset,:nd4j-cuda-12.1
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Full debug build for CUDA backend with all debug flags enabled
|
||||
|
||||
cd ..
|
||||
mvn -Pcuda -Dlibnd4j.chip=cuda clean install -DskipTests \
|
||||
-Dlibnd4j.build=debug \
|
||||
-Dlibnd4j.calltrace=ON \
|
||||
-Dlibnd4j.printmath=ON \
|
||||
-Dlibnd4j.printindices=ON \
|
||||
-Dlibnd4j.sanitize=ON \
|
||||
-Dlibnd4j.keepnvcc=ON \
|
||||
-Dlibnd4j.sanitizers="address,undefined,float-divide-by-zero,float-cast-overflow" \
|
||||
-pl :libnd4j,:nd4j-cuda-12.1-preset,:nd4j-cuda-12.1
|
||||
Reference in New Issue
Block a user