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



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'ext/cumo/extconf.rb', line 175

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("#include <cudnn.h>\n#if CUDNN_MAJOR < \#{CUDNN_MIN_MAJOR}\n#error \"cuDNN is too old\"\n#endif\nint main(void) { return 0; }\n    SRC\n  end\n  unless ok\n    message(\"cuDNN is older than \#{CUDNN_MIN_MAJOR}.0; building without cuDNN features\\n\")\n    return false\n  end\n  unless have_library('cudnn')\n    message(\"cuDNN library not found; building without cuDNN features\\n\")\n    return false\n  end\n  true\nend\n")