Top Level Namespace

Defined Under Namespace

Modules: <%= full_module_name %>, Decl, DeclMethod, Numo Classes: DefAlias, DefAllocFunc, DefClass, DefConst, DefError, DefInclueModule, DefLib, DefLinalgFunction, DefMethod, DefModule, DefModuleFunction, DefStruct, ErbPP, UndefAllocFunc, UndefMethod, UndefSingletonMethod

Instance Method Summary collapse

Instance Method Details

#create_depend(base_dir) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'ext/numo/linalg/mkmf_linalg.rb', line 72

def create_depend(base_dir)
  require 'erb'
  message "creating depend\n"
  dep_path = "#{base_dir}/depend"
  File.open(dep_path, "w") do |dep|
    dep_erb_path = "#{base_dir}/depend.erb"
    File.open(dep_erb_path, "r") do |dep_erb|
      erb = ERB.new(dep_erb.read)
      erb.filename = dep_erb_path
      dep.print(erb.result)
    end
  end
end

#create_site_confObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'ext/numo/linalg/mkmf_linalg.rb', line 3

def create_site_conf
  ldirs = [
    dir_config("mkl")[1],
    dir_config("openblas")[1],
    dir_config("atlas")[1],
    dir_config("blas")[1],
    dir_config("lapack")[1],
  ]
  bked = with_config("backend")

  require 'fiddle'

  message "creating lib/site_conf.rb\n"

  FileUtils.mkdir_p "lib"

  ext = detect_library_extension

  open("lib/site_conf.rb","w"){|f| f.write "
module Numo
  module Linalg

    BACKEND = #{bked.inspect}
    MKL_LIBPATH = #{ldirs[0].inspect}
    OPENBLAS_LIBPATH = #{ldirs[1].inspect}
    ATLAS_LIBPATH = #{ldirs[2].inspect}
    BLAS_LIBPATH = #{ldirs[3].inspect}
    LAPACK_LIBPATH = #{ldirs[4].inspect}

    module Loader
      EXT = '#{ext}'
    end

  end
end"
  }
end

#detect_library_extensionObject



41
42
43
44
45
46
47
48
49
50
# File 'ext/numo/linalg/mkmf_linalg.rb', line 41

def detect_library_extension
  case RbConfig::CONFIG['host_os']
  when /mswin|msys|mingw|cygwin/
    'dll'
  when /darwin|mac os/
    'dylib'
  else
    'so'
  end
end

#find_libnarray_aObject



63
64
65
66
67
68
69
70
# File 'ext/numo/linalg/mkmf_linalg.rb', line 63

def find_libnarray_a
  $LOAD_PATH.each do |x|
    if File.exist? File.join(x,'numo/libnarray.a')
      $LDFLAGS = "-L#{x}/numo " + $LDFLAGS
      break
    end
  end
end

#find_narray_hObject



54
55
56
57
58
59
60
61
# File 'ext/numo/linalg/mkmf_linalg.rb', line 54

def find_narray_h
  $LOAD_PATH.each do |x|
    if File.exist? File.join(x,'numo/numo/narray.h')
      $INCFLAGS = "-I#{x}/numo " + $INCFLAGS
      break
    end
  end
end