Top Level Namespace

Defined Under Namespace

Modules: <%= full_module_name %>, Cumo, DeclMethod, NArrayMethod, NArrayType, NMathMethod, StoreFrom Classes: DefAlias, DefAllocFunc, DefClass, DefConst, DefError, DefInclueModule, DefLib, DefMethod, DefModule, DefModuleFunction, DefStruct, ErbPP, Store, StoreArray, StoreNum, UndefAllocFunc, UndefMethod, UndefSingletonMethod

Constant Summary collapse

HEADER_DIRS =
(ENV['CPATH'] || '').split(File::PATH_SEPARATOR)
LIB_DIRS =
(ENV['LIBRARY_PATH'] || '').split(File::PATH_SEPARATOR)
CUDNN_MIN_MAJOR =

cuDNN 8 is the first release that supports CUDA 11, which cumo requires.

8

Instance Method Summary collapse

Instance Method Details

#create_dependObject



13
14
15
16
17
18
19
20
21
22
23
# File 'ext/cumo/extconf.rb', line 13

def create_depend
  message "creating depend\n"
  File.open(d("depend"), "w") do |depend|
    depend_erb_path = d("depend.erb")
    File.open(depend_erb_path, "r") do |depend_erb|
      erb = ERB.new(depend_erb.read)
      erb.filename = depend_erb_path
      depend.print(erb.result)
    end
  end
end

#d(file) ⇒ Object



9
10
11
# File 'ext/cumo/extconf.rb', line 9

def d(file)
  File.join(__dir__, file)
end

#have_cudnn?Boolean

Returns:

  • (Boolean)


171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'ext/cumo/extconf.rb', line 171

def have_cudnn?
  unless have_header('cudnn.h')
    message("cuDNN header not found; building without cuDNN features\n")
    return false
  end
  ok = checking_for("cuDNN #{CUDNN_MIN_MAJOR} or later") do
    try_compile(<<-SRC)
#include <cudnn.h>
#if CUDNN_MAJOR < #{CUDNN_MIN_MAJOR}
#error "cuDNN is too old"
#endif
int main(void) { return 0; }
    SRC
  end
  unless ok
    message("cuDNN is older than #{CUDNN_MIN_MAJOR}.0; building without cuDNN features\n")
    return false
  end
  unless have_library('cudnn')
    message("cuDNN library not found; building without cuDNN features\n")
    return false
  end
  true
end