Module: BOAST::CompiledRuntime

Included in:
CRuntime, FORTRANRuntime
Defined in:
lib/BOAST/Runtime/MAQAO.rb,
lib/BOAST/Runtime/CompiledRuntime.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#binaryObject

Returns the value of attribute binary.



34
35
36
# File 'lib/BOAST/Runtime/CompiledRuntime.rb', line 34

def binary
  @binary
end

#sourceObject

Returns the value of attribute source.



35
36
37
# File 'lib/BOAST/Runtime/CompiledRuntime.rb', line 35

def source
  @source
end

Instance Method Details

#build(options = {}) ⇒ Object



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/BOAST/Runtime/CompiledRuntime.rb', line 409

def build(options={})
  compiler_options = BOAST::get_compiler_options
  compiler_options.update(options)
  linker, ldshared, ldflags = setup_compilers(compiler_options)
  @compiler_options = compiler_options
  @probes = []
  if @compiler_options[:probes] then
    @probes = @compiler_options[:probes]
  elsif get_lang != CUDA
    @probes = [TimerProbe, PAPIProbe]
    @probes.push EnergyProbe if EnergyProbe
    @probes.push AffinityProbe unless OS.mac?
  end
  @probes = [MPPAProbe] if @architecture == MPPA

  @marker = Tempfile::new([@procedure.name,""])

  kernel_files = get_sub_kernels

  create_sources

  save_source

  create_targets(linker, ldshared, ldflags, kernel_files)

  save_binary

  load_module

  cleanup(kernel_files) unless keep_temp

  eval "self.extend(#{module_name})"

  return self
end

#dump_binaryObject



445
446
447
448
449
450
# File 'lib/BOAST/Runtime/CompiledRuntime.rb', line 445

def dump_binary
  f = File::open(library_object,"wb")
  @binary.rewind
  f.write( @binary.read )
  f.close
end

#dump_sourceObject



452
453
454
455
456
457
# File 'lib/BOAST/Runtime/CompiledRuntime.rb', line 452

def dump_source
  f = File::open(library_source,"wb")
  @source.rewind
  f.write( @source.read )
  f.close
end

#maqao_analysis(options = {}) ⇒ Object



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
# File 'lib/BOAST/Runtime/MAQAO.rb', line 4

def maqao_analysis(options={})
  maqao_models = {
    "core2" => "CORE2_45", 
    "nehalem" => "NEHALEM",
    "sandybridge" => "SANDY_BRIDGE",
    "ivybridge" => "IVY_BRIDGE",
    "haswell" => "HASWELL"
  }
  compiler_options = BOAST::get_compiler_options
  compiler_options.update(options)

  f1 = File::open(library_object,"wb")
  @binary.rewind
  f1.write( @binary.read )
  f1.close

  f2 = File::open(library_source,"wb")
  @source.rewind
  f2.write( @source.read )
  f2.close
  maqao_model = maqao_models[get_model]
  if verbose? then
    puts "#{compiler_options[:MAQAO]} cqa #{maqao_model ? "--uarch=#{maqao_model} " : ""}#{f1.path} --fct=#{@procedure.name} #{compiler_options[:MAQAO_FLAGS]}"
  end
  result = `#{compiler_options[:MAQAO]} cqa #{maqao_model ? "--uarch=#{maqao_model} " : ""}#{f1.path} --fct=#{@procedure.name} #{compiler_options[:MAQAO_FLAGS]}`
  File::unlink(library_object) unless keep_temp
  File::unlink(library_source) unless keep_temp
  return result
end