<commit_before>require "mkmf"
have_library("c++") or have_library("stdc++")

gems = Gem::Specification.find_all_by_name("numo-narray")
if gems.size > 1
  raise "multiple numo-narray gems found"
end
find_header("numo/narray.h", File.join(gems[0].gem_dir, "lib/numo/") )

have_func("rb_gc_adjust_memory_usage")

backend_flag = ""

if arg_config("--enable-cuda")
  require "mkmf-cu"
  backend_flag += " -DVIENNACL_WITH_CUDA -x cu "
elsif arg_config("--enable-opencl") and (have_library("OpenCL") or have_framework("OpenCL"))
  backend_flag += " -DVIENNACL_WITH_OPENCL "
end

if arg_config("--enable-openmp")
  backend_flag += " -fopenmp -DVIENNACL_WITH_OPENMP "
end

viennacl_path = File.join(File.dirname(File.expand_path(__FILE__)), "viennacl/")

$CXXFLAGS = ($CXXFLAGS || "") + " -std=c++11 -I #{viennacl_path} #{backend_flag} "
create_makefile('viennacl/ViennaCL')<commit_msg>use find_header for viennacl header path setting<commit_after>require "mkmf"
have_library("c++") or have_library("stdc++")

gems = Gem::Specification.find_all_by_name("numo-narray")
if gems.size > 1
  raise "multiple numo-narray gems found"
end
find_header("numo/narray.h", File.join(gems[0].gem_dir, "lib/numo/") )
find_header("viennacl/version.hpp", File.join(File.dirname(File.expand_path(__FILE__)), "viennacl/"))
have_func("rb_gc_adjust_memory_usage")

backend_flag = ""

if arg_config("--enable-cuda")
  require "mkmf-cu"
  backend_flag += " -DVIENNACL_WITH_CUDA -x cu "
elsif arg_config("--enable-opencl") and (have_library("OpenCL") or have_framework("OpenCL"))
  backend_flag += " -DVIENNACL_WITH_OPENCL "
end

if arg_config("--enable-openmp")
  backend_flag += " -fopenmp -DVIENNACL_WITH_OPENMP "
end

$CXXFLAGS = ($CXXFLAGS || "") + " -std=c++11 #{backend_flag} "
create_makefile('viennacl/ViennaCL')
{'fraction_non_alphanumeric': 0.16778523489932887, 'fraction_numerical': 0.0044742729306487695, 'mean_word_length': 6.184738955823293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7521854', 'n_tokens_mistral': 728, 'n_tokens_neox': 695, 'n_words': 111}