MetaX-Tech Developer Forum 论坛首页
  • 沐曦开发者
search
Sign in

BashirW

  • Members
  • Joined 2025年8月14日
  • message 帖子
  • forum 主题
  • favorite 关注者
  • favorite_border Follows
  • person_outline 详细信息

BashirW has posted 3 messages.

  • See post chevron_right
    BashirW
    Members
    maca 3.3.0编译报错 提示“'tuple' file not found” 解决中 2025年12月16日 11:03

    代码如下:

    #include <iostream>
    #include <vector>
    #include <chrono>
    #include <thread>
    #include <cuda_runtime.h>
    
    // CUDA错误检查宏
    void checkCudaError(cudaError_t err, const char* msg) {
        if (err != cudaSuccess) {
            std::cerr << "CUDA Error: " << msg << " - " << cudaGetErrorString(err) << std::endl;
            exit(EXIT_FAILURE);
        }
    }
    
    int main() {
        std::cout << "=== MetaX C500 VRAM Leak Simulation ===" << std::endl;
        std::cout << "WARNING: This program will intentionally leak GPU memory!" << std::endl;
        std::cout << "Press Ctrl+C to stop the test." << std::endl << std::endl;
    
        // 获取设备信息
        int deviceCount;
        checkCudaError(cudaGetDeviceCount(&deviceCount), "cudaGetDeviceCount");
        if (deviceCount == 0) {
            std::cerr << "Error: No CUDA-compatible GPU found!" << std::endl;
            return 1;
        }
    
        // 选择GPU设备(可根据需要修改设备ID)
        int deviceId = 0;
        checkCudaError(cudaSetDevice(deviceId), "cudaSetDevice");
    
        cudaDeviceProp prop;
        checkCudaError(cudaGetDeviceProperties(&prop, deviceId), "cudaGetDeviceProperties");
        std::cout << "Target Device: " << prop.name << std::endl;
        std::cout << "Total VRAM: " << (prop.totalGlobalMem / 1024 / 1024) << " MB" << std::endl;
        std::cout << std::endl;
    
        // 配置参数
        const size_t ALLOCATION_SIZE = 50 * 1024 * 1024; // 每次分配50MB
        const int ALLOCATIONS_PER_BATCH = 10;            // 每批分配次数
        const int BATCH_DELAY_MS = 500;                  // 批次间延迟(毫秒)
    
        std::vector<void*> allocations;
        size_t totalAllocated = 0;
        int allocationCount = 0;
    
        try {
            while (true) {
                // 批量分配显存
                for (int i = 0; i < ALLOCATIONS_PER_BATCH; ++i) {
                    void* ptr = nullptr;
                    cudaError_t err = cudaMalloc(&ptr, ALLOCATION_SIZE);
    
                    if (err != cudaSuccess) {
                        std::cerr << "\n[ERROR] Allocation failed!" << std::endl;
                        std::cerr << "  Allocation number: " << allocationCount << std::endl;
                        std::cerr << "  Total allocated: " << (totalAllocated / 1024 / 1024) << " MB" << std::endl;
                        std::cerr << "  CUDA Error: " << cudaGetErrorString(err) << std::endl;
    
                        // 显示近似剩余显存
                        size_t free, total;
                        cudaMemGetInfo(&free, &total);
                        std::cerr << "  Approximate free VRAM: " << (free / 1024 / 1024) << " MB" << std::endl;
    
                        throw std::runtime_error("Out of memory");
                    }
    
                    allocations.push_back(ptr);
                    totalAllocated += ALLOCATION_SIZE;
                    allocationCount++;
                }
    
                // 打印进度
                std::cout << "[LEAK] Allocations: " << allocationCount
                          << " | Total: " << (totalAllocated / 1024 / 1024) << " MB"
                          << std::endl;
    
                // 延迟一段时间,便于观察
                std::this_thread::sleep_for(std::chrono::milliseconds(BATCH_DELAY_MS));
            }
        }
        catch (const std::exception& e) {
            std::cerr << "\nTest completed: " << e.what() << std::endl;
        }
    
        // 说明:程序故意不释放内存以模拟泄漏
        // 问题:进程退出后GPU驱动会自动回收显存么?
    
        std::cout << "\n=== Test Finished ===" << std::endl;
        std::cout << "To clean up: Terminate this process (Ctrl+C) or let it crash." << std::endl;
        std::cout << "Driver will automatically free leaked memory on process exit." << std::endl;
    
        return 0;
    }
    
  • See post chevron_right
    BashirW
    Members
    maca 3.3.0编译报错 提示“'tuple' file not found” 解决中 2025年12月16日 10:38

    1.服务器厂家: 浪潮信息 NF5468M7
    2.沐曦GPU型号:MX C500
    3.操作系统内核版本:KeyarchOS v5
    4.是否开启CPU虚拟化:已开启,CPU信息如下:
    Architecture: x86_64
    CPU op-mode(s): 32-bit, 64-bit
    Address sizes: 52 bits physical, 57 bits virtual
    Byte Order: Little Endian
    CPU(s): 128
    On-line CPU(s) list: 0-127
    Vendor ID: GenuineIntel
    BIOS Vendor ID: Intel(R) Corporation
    Model name: INTEL(R) XEON(R) GOLD 6530
    BIOS Model name: INTEL(R) XEON(R) GOLD 6530 CPU @ 2.1GHz
    BIOS CPU family: 179
    CPU family: 6
    Model: 207
    Thread(s) per core: 2
    Core(s) per socket: 32
    Socket(s): 2
    Stepping: 2
    CPU(s) scaling MHz: 23%
    CPU max MHz: 4000.0000
    CPU min MHz: 800.0000
    BogoMIPS: 4200.00
    Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
    pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid ap
    erfmperf tsc_known_freq pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 ss
    e4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_
    l3 cat_l2 cdp_l3 intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fs
    gsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clf
    lushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm
    total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp
    epp hwp_pkg_req vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg t
    me avx512_vpopcntdq rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig
    arch_lbr ibt amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
    Virtualization features:
    Virtualization: VT-x
    Caches (sum of all):
    L1d: 3 MiB (64 instances)
    L1i: 2 MiB (64 instances)
    L2: 128 MiB (64 instances)
    L3: 320 MiB (2 instances)
    NUMA:
    NUMA node(s): 2
    NUMA node0 CPU(s): 0-31,64-95
    NUMA node1 CPU(s): 32-63,96-127
    Vulnerabilities:
    Gather data sampling: Not affected
    Itlb multihit: Not affected
    L1tf: Not affected
    Mds: Not affected
    Meltdown: Not affected
    Mmio stale data: Not affected
    Reg file data sampling: Not affected
    Retbleed: Not affected
    Spec rstack overflow: Not affected
    Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
    Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
    Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
    Srbds: Not affected
    Tsx async abort: Not affected

    5.mx-smi回显:
    mx-smi version: 2.2.1

    =================== MetaX System Management Interface Log ===================
    Timestamp : Tue Dec 16 10:35:48 2025

    Attached GPUs : 1
    +---------------------------------------------------------------------------------+
    | MX-SMI 2.2.1 Kernel Mode Driver Version: 2.12.0 |
    | MACA Version: 3.3.0.15 BIOS Version: 1.23.1.0 |
    |------------------------------------+---------------------+----------------------+
    | GPU NAME | Bus-id | GPU-Util |
    | Temp Pwr:Usage/Cap | Memory-Usage | |
    |====================================+=====================+======================|
    | 0 MetaX C500 | 0000:58:00.0 | 0% |
    | 44C 32W / 350W | 858/65536 MiB | |
    +------------------------------------+---------------------+----------------------+

    +---------------------------------------------------------------------------------+
    | Process: |
    | GPU PID Process Name GPU Memory |
    | Usage(MiB) |
    |=================================================================================|
    | no process found |
    +---------------------------------------------------------------------------------+

    End of Log

    错误提示如下:
    mxcc -std=c++20 -o 04-vram_leak_sim 04-vram_leak_sim.cu
    In file included from <built-in>:1:
    In file included from /opt/maca-3.3.0/mxgpu_llvm/lib/clang/19/include/__clang_maca_runtime_wrapper.h:25:
    In file included from /opt/maca-3.3.0/mxgpu_llvm/lib/clang/19/include/__clang_maca_atomic_functions.h:18:
    In file included from /opt/maca-3.3.0/include/common/__clang_maca_mckl_lib_header.h:25:
    In file included from /opt/maca-3.3.0/include/mcr/mc_reference_surface_types.h:12:
    In file included from /opt/maca-3.3.0/include/mcr/mc_runtime_api.h:7579:
    /opt/maca-3.3.0/include/mcr/mc_runtime_api_template_wrapper.h:3:10: fatal error: 'tuple' file not found
    3 | #include <tuple>
    | ^~~
    1 error generated when compiling for xcore1000.

  • See post chevron_right
    BashirW
    Members
    maca 3.3.0编译报错 提示“'tuple' file not found” 解决中 2025年12月16日 10:10

    基于maca开发一个简单的测试程序,但是编译时报错:
    mxcc -std=c++11 -o 04-vram_leak_sim 04-vram_leak_sim.cu
    In file included from <built-in>:1:
    In file included from /opt/maca-3.3.0/mxgpu_llvm/lib/clang/19/include/__clang_maca_runtime_wrapper.h:25:
    In file included from /opt/maca-3.3.0/mxgpu_llvm/lib/clang/19/include/__clang_maca_atomic_functions.h:18:
    In file included from /opt/maca-3.3.0/include/common/__clang_maca_mckl_lib_header.h:25:
    In file included from /opt/maca-3.3.0/include/mcr/mc_reference_surface_types.h:12:
    In file included from /opt/maca-3.3.0/include/mcr/mc_runtime_api.h:7579:
    /opt/maca-3.3.0/include/mcr/mc_runtime_api_template_wrapper.h:3:10: fatal error: 'tuple' file not found
    3 | #include <tuple>
    | ^~~
    1 error generated when compiling for xcore1000.

    使用的CPU为metax C500

  • 沐曦开发者论坛
powered by misago