[PR #21] [CLOSED] pytest Integration #207

Closed
opened 2026-10-26 21:14:52 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/21
Author: @A-transformer
Created: 2/27/2025
Status: ❌ Closed

Base: main ← Head: A-transformer-patch-2


📝 Commits (3)

📊 Changes

3 files changed (+149 additions, -117 deletions)

View changed files

📝 README.md (+3 -2)
📝 tests/test_core.py (+99 -102)
📝 tests/test_jit.py (+47 -13)

📄 Description

Decorate the test function with @pytest.mark.skipif(...) so the test is skipped if CUDA is unavailable. Move all testing logic into a function named test_jit() so it’s automatically discoverable by pytest.

CUTLASS Configuration
Ensure that the CUTLASS_ROOT environment variable is set. For example:
export CUTLASS_ROOT=/root/DeepGEMM/third-party/cutlass
export CPATH="$CUTLASS_ROOT/include:$CPATH"
export CPLUS_INCLUDE_PATH="$CUTLASS_ROOT/include:$CPLUS_INCLUDE_PATH"

Running the Tests:
pip install pytest
pytest tests/test_jit.py -v -s

===================================================================================== test session starts =====================================================================================
platform linux -- Python 3.11.11, pytest-8.3.4, pluggy-1.5.0 -- /root/miniconda3/envs/gemm/bin/python
cachedir: .pytest_cache
rootdir: /root/autodl-tmp/DeepGEMM
collected 1 item

tests/test_jit.py::test_jit NVCC compiler: ('/usr/local/cuda/bin/nvcc', '12.4')

Generated code:
// DeepGEMM auto-generated JIT CUDA source file

#include <cuda.h>
#include <cuda_fp8.h>
#include <cuda_runtime.h>
#include

#include "cutlass/cutlass.h"

extern "C" void launch(void* __raw_lhs, void* __raw_rhs, void* __raw_scale, void* __raw_out, bool enable_double_streams, void* __raw_stream, int& __return_code) {
// Cast raw types (if needed)
auto lhs = reinterpret_cast<__nv_fp8_e4m3*>(__raw_lhs);
auto rhs = reinterpret_cast<__nv_fp8_e4m3*>(__raw_rhs);
auto scale = reinterpret_cast<float*>(__raw_scale);
auto out = reinterpret_cast<__nv_bfloat16*>(__raw_out);
auto stream = reinterpret_cast<cudaStream_t>(__raw_stream);
std::cout << reinterpret_cast<uint64_t>(lhs) << std::endl;
std::cout << reinterpret_cast<uint64_t>(rhs) << std::endl;
std::cout << reinterpret_cast<uint64_t>(scale) << std::endl;
std::cout << reinterpret_cast<uint64_t>(out) << std::endl;
std::cout << enable_double_streams << std::endl;
std::cout << reinterpret_cast<uint64_t>(stream) << std::endl;
}

Building ...
Running ...
JIT test passed
PASSED

====================================================================================== 1 passed in 6.18s ======================================================================================

image

Test environment on H800 ,cuda 12.7 , Python 3.11.11, pytest-8.3.4, pluggy-1.5.0

Thu Feb 27 14:13:11 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 565.57.01 Driver Version: 565.57.01 CUDA Version: 12.7 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA H800 PCIe On | 00000000:39:00.0 Off | Off |
| N/A 31C P0 49W / 350W | 1MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepGEMM/pull/21 **Author:** [@A-transformer](https://github.com/A-transformer) **Created:** 2/27/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `A-transformer-patch-2` --- ### 📝 Commits (3) - [`58046b4`](https://github.com/deepseek-ai/DeepGEMM/commit/58046b4e0189d1391bccbd922e1c501ab826acde) pytest Integration - [`f9a6da9`](https://github.com/deepseek-ai/DeepGEMM/commit/f9a6da9ac24a0dc507912ef901b0337bb9c6ff33) pytest Integration - [`5479ffe`](https://github.com/deepseek-ai/DeepGEMM/commit/5479ffebb0699b8f3206738dcfd3d066f7e2a3b5) pytest Integration ### 📊 Changes **3 files changed** (+149 additions, -117 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -2) 📝 `tests/test_core.py` (+99 -102) 📝 `tests/test_jit.py` (+47 -13) </details> ### 📄 Description Decorate the test function with @pytest.mark.skipif(...) so the test is skipped if CUDA is unavailable. Move all testing logic into a function named test_jit() so it’s automatically discoverable by pytest. **CUTLASS Configuration** Ensure that the CUTLASS_ROOT environment variable is set. For example: export CUTLASS_ROOT=/root/DeepGEMM/third-party/cutlass export CPATH="$CUTLASS_ROOT/include:$CPATH" export CPLUS_INCLUDE_PATH="$CUTLASS_ROOT/include:$CPLUS_INCLUDE_PATH" **Running the Tests:** pip install pytest pytest tests/test_jit.py -v -s ===================================================================================== test session starts ===================================================================================== platform linux -- Python 3.11.11, pytest-8.3.4, pluggy-1.5.0 -- /root/miniconda3/envs/gemm/bin/python cachedir: .pytest_cache rootdir: /root/autodl-tmp/DeepGEMM collected 1 item tests/test_jit.py::test_jit NVCC compiler: ('/usr/local/cuda/bin/nvcc', '12.4') Generated code: // DeepGEMM auto-generated JIT CUDA source file #include <cuda.h> #include <cuda_fp8.h> #include <cuda_runtime.h> #include <iostream> #include "cutlass/cutlass.h" extern "C" void launch(void* __raw_lhs, void* __raw_rhs, void* __raw_scale, void* __raw_out, bool enable_double_streams, void* __raw_stream, int& __return_code) { // Cast raw types (if needed) auto lhs = reinterpret_cast<__nv_fp8_e4m3*>(__raw_lhs); auto rhs = reinterpret_cast<__nv_fp8_e4m3*>(__raw_rhs); auto scale = reinterpret_cast<float*>(__raw_scale); auto out = reinterpret_cast<__nv_bfloat16*>(__raw_out); auto stream = reinterpret_cast<cudaStream_t>(__raw_stream); std::cout << reinterpret_cast<uint64_t>(lhs) << std::endl; std::cout << reinterpret_cast<uint64_t>(rhs) << std::endl; std::cout << reinterpret_cast<uint64_t>(scale) << std::endl; std::cout << reinterpret_cast<uint64_t>(out) << std::endl; std::cout << enable_double_streams << std::endl; std::cout << reinterpret_cast<uint64_t>(stream) << std::endl; } Building ... Running ... JIT test passed PASSED ====================================================================================== 1 passed in 6.18s ====================================================================================== ![image](https://github.com/user-attachments/assets/11e4cc04-4038-4db2-8631-853f7c7d0c97) Test environment on H800 ,cuda 12.7 , Python 3.11.11, pytest-8.3.4, pluggy-1.5.0 Thu Feb 27 14:13:11 2025 +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 565.57.01 Driver Version: 565.57.01 CUDA Version: 12.7 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA H800 PCIe On | 00000000:39:00.0 Off | Off | | N/A 31C P0 49W / 350W | 1MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ +-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | No running processes found | +-----------------------------------------------------------------------------------------+ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 21:14:52 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepGEMM#207
No description provided.