github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/gpus/cuda/BUILD.windows.tpl (about)

     1  load(":build_defs.bzl", "cuda_header_library")
     2  
     3  licenses(["restricted"])  # MPL2, portions GPL v3, LGPL v3, BSD-like
     4  
     5  package(default_visibility = ["//visibility:public"])
     6  
     7  config_setting(
     8      name = "using_nvcc",
     9      values = {
    10          "define": "using_cuda_nvcc=true",
    11      },
    12  )
    13  
    14  config_setting(
    15      name = "using_clang",
    16      values = {
    17          "define": "using_cuda_clang=true",
    18      },
    19  )
    20  
    21  # Equivalent to using_clang && -c opt.
    22  config_setting(
    23      name = "using_clang_opt",
    24      values = {
    25          "define": "using_cuda_clang=true",
    26          "compilation_mode": "opt",
    27      },
    28  )
    29  
    30  config_setting(
    31      name = "darwin",
    32      values = {"cpu": "darwin"},
    33  )
    34  
    35  config_setting(
    36      name = "freebsd",
    37      values = {"cpu": "freebsd"},
    38  )
    39  
    40  # Provides CUDA headers for '#include "third_party/gpus/cuda/include/cuda.h"'
    41  # All clients including TensorFlow should use these directives.
    42  cuda_header_library(
    43      name = "cuda_headers",
    44      hdrs = [
    45          "cuda/cuda_config.h",
    46          ":cuda-include"
    47      ],
    48      include_prefix = "third_party/gpus",
    49      includes = [
    50          ".",  # required to include cuda/cuda/cuda_config.h as cuda/config.h
    51          "cuda/include",
    52      ],
    53  )
    54  
    55  cc_import(
    56      name = "cudart_static",
    57      # /WHOLEARCHIVE:cudart_static.lib will cause a
    58      # "Internal error during CImplib::EmitThunk" error.
    59      # Treat this library as interface library to avoid being whole archived when
    60      # linking a DLL that depends on this.
    61      # TODO(pcloudy): Remove this rule after b/111278841 is resolved.
    62      interface_library = "cuda/lib/%{cudart_static_lib}",
    63      system_provided = 1,
    64  )
    65  
    66  cc_import(
    67      name = "cuda_driver",
    68      interface_library = "cuda/lib/%{cuda_driver_lib}",
    69      system_provided = 1,
    70  )
    71  
    72  cc_import(
    73      name = "cudart",
    74      interface_library = "cuda/lib/%{cudart_lib}",
    75      system_provided = 1,
    76  )
    77  
    78  cuda_header_library(
    79      name = "cublas_headers",
    80      hdrs = [":cublas-include"],
    81      include_prefix = "third_party/gpus/cuda/include",
    82      includes = ["cublas/include"],
    83      strip_include_prefix = "cublas/include",
    84      deps = [":cuda_headers"],
    85  )
    86  
    87  cc_import(
    88      name = "cublas",
    89      interface_library = "cuda/lib/%{cublas_lib}",
    90      system_provided = 1,
    91  )
    92  
    93  cc_import(
    94      name = "cusolver",
    95      interface_library = "cuda/lib/%{cusolver_lib}",
    96      system_provided = 1,
    97  )
    98  
    99  cc_import(
   100      name = "cudnn",
   101      interface_library = "cuda/lib/%{cudnn_lib}",
   102      system_provided = 1,
   103  )
   104  
   105  cc_library(
   106      name = "cudnn_header",
   107      hdrs = [":cudnn-include"],
   108      include_prefix = "third_party/gpus/cudnn",
   109      strip_include_prefix = "cudnn/include",
   110      deps = [":cuda_headers"],
   111  )
   112  
   113  cc_import(
   114      name = "cufft",
   115      interface_library = "cuda/lib/%{cufft_lib}",
   116      system_provided = 1,
   117  )
   118  
   119  cc_import(
   120      name = "curand",
   121      interface_library = "cuda/lib/%{curand_lib}",
   122      system_provided = 1,
   123  )
   124  
   125  cc_library(
   126      name = "cuda",
   127      deps = [
   128          ":cublas",
   129          ":cuda_headers",
   130          ":cudart",
   131          ":cudnn",
   132          ":cufft",
   133          ":curand",
   134      ],
   135  )
   136  
   137  cuda_header_library(
   138      name = "cupti_headers",
   139      hdrs = [":cuda-extras"],
   140      include_prefix="third_party/gpus",
   141      includes = ["cuda/extras/CUPTI/include/"],
   142      deps = [":cuda_headers"],
   143  )
   144  
   145  cc_import(
   146      name = "cupti_dsos",
   147      interface_library = "cuda/lib/%{cupti_lib}",
   148      system_provided = 1,
   149  )
   150  
   151  cc_import(
   152      name = "cusparse",
   153      interface_library = "cuda/lib/%{cusparse_lib}",
   154      system_provided = 1,
   155  )
   156  
   157  cc_library(
   158      name = "libdevice_root",
   159      data = [":cuda-nvvm"],
   160  )
   161  
   162  %{copy_rules}