zoukankan      html  css  js  c++  java
  • bazel编译tvm和cuda

    在docker中编译tvm和cuda,工程是tensorflow-serving所以要使用bazel编译器,在docker中可以看到显卡驱动和cuda版本,但是编译的时候总是找不到头文件

     

     后来做了个软连接,将cuda目录映射到库目录下就解决了

    ln -s /usr/local/cuda-11.0/include /usr/include/cuda

    然后把对应文件(调用到cuda.h)的头文件位置改一下

    #include<cuda.h>改为#include<cuda/include/cuda.h>

    #include<cuda_runtime.h>改为#include<cuda/include/cuda_runtime.h>

    就ok了

     BUILD文件

    # TVM (tvm.ai) library.
    # from https://github.com/apache/tvm.git
    
    package(
        default_visibility = ["//visibility:public"],
    )
    
    licenses(["notice"])  # Apache
    
    exports_files(["LICENSE"])
    
    cc_library(
        name = "tvm_runtime",
        srcs = [
            "src/runtime/c_runtime_api.cc",
            "src/runtime/cpu_device_api.cc",
        "src/runtime/file_utils.cc",
        "src/runtime/library_module.cc",
        "src/runtime/module.cc",
        "src/runtime/ndarray.cc",
        "src/runtime/object.cc",
        "src/runtime/registry.cc",
        "src/runtime/thread_pool.cc",
        "src/runtime/threading_backend.cc",
        "src/runtime/workspace_pool.cc",
        "src/runtime/dso_library.cc",
        "src/runtime/system_library.cc",
        "src/runtime/graph/graph_runtime.cc",
        "src/runtime/graph/graph_runtime_factory.cc",
        "src/runtime/cuda/cuda_device_api.cc",
        "src/runtime/cuda/cuda_module.cc",
        ],
        hdrs = glob([
          "3rdparty/dmlc-core/include/**/*.h",
          "include/**/*.h",
          "3rdparty/dlpack/include/**/*.h",
          "src/runtime/**/*.h",
        ]),
        includes = ["3rdparty/dmlc-core/include",
                "include",
                "3rdparty/dlpack/include",
            "src/runtime",
        ],
        alwayslink = 1,
    )
    无情的摸鱼机器
  • 相关阅读:
    12 Essential Bootstrap Tools for Web Designers
    S.O.L.I.D 是面向对象设计(OOD)和面向对象编程(OOP)中的几个重要编码原则
    cocos2d3.0rc编译android工程
    Android和iOS中Cocos2dx的横屏竖屏设置
    cocos2d-x 3.0rc开发指南:Windows下Android环境搭建
    C#第一个windows窗体应用程序
    程序员技术练级攻略
    11个强大的Visual Studio调试小技巧
    Model--汇总
    UIView---汇总
  • 原文地址:https://www.cnblogs.com/wangtianning1223/p/14607001.html
Copyright © 2011-2022 走看看