BOAST 0.999 → 0.9991

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/BOAST.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'BOAST'
3
- s.version = "0.999"
3
+ s.version = "0.9991"
4
4
  s.author = "Brice Videau"
5
5
  s.email = "brice.videau@imag.fr"
6
6
  s.homepage = "https://forge.imag.fr/projects/boast/"
data/lib/BOAST/CKernel.rb CHANGED
@@ -20,6 +20,10 @@ module BOAST
20
20
  :NVCCFLAGS => '-O2',
21
21
  :LDFLAGS => '',
22
22
  :CLFLAGS => '',
23
+ :CLVENDOR => nil,
24
+ :CLPLATFORM => nil,
25
+ :CLDEVICE => nil,
26
+ :CLDEVICETYPE => nil,
23
27
  :openmp => false
24
28
  }
25
29
 
@@ -252,27 +256,44 @@ module BOAST
252
256
  return ld_flags
253
257
  end
254
258
 
255
- def build_opencl(options)
256
- require 'opencl_ruby_ffi'
257
- platform = nil
259
+ def select_cl_platform(options)
258
260
  platforms = OpenCL::get_platforms
259
261
  if options[:platform_vendor] then
260
- platforms.each{ |p|
261
- platform = p if p.vendor.match(options[:platform_vendor])
262
+ platforms.select!{ |p|
263
+ p.vendor.match(options[:platform_vendor])
264
+ }
265
+ elsif options[:CLVENDOR] then
266
+ platforms.select!{ |p|
267
+ p.vendor.match(options[:CLVENDOR])
262
268
  }
263
- else
264
- platform = platforms.first
265
269
  end
266
- device = nil
267
- type = options[:device_type] ? options[:device_type] : OpenCL::Device::Type::ALL
270
+ if options[:CLPLATFORM] then
271
+ platforms.select!{ |p|
272
+ p.name.match(options[:CLPLATFORM])
273
+ }
274
+ end
275
+ return platforms.first
276
+ end
277
+
278
+ def select_cl_device(options)
279
+ platform = select_cl_platform(options)
280
+ type = options[:device_type] ? OpenCL::Device::Type.const_get(options[:device_type]) : options[:CLDEVICETYPE] ? OpenCL::Device::Type.const_get(options[:CLDEVICETYPE]) : OpenCL::Device::Type::ALL
268
281
  devices = platform.devices(type)
269
282
  if options[:device_name] then
270
- devices.each{ |d|
271
- device = d if d.name.match(options[:device_name])
283
+ devices.select!{ |d|
284
+ d.name.match(options[:device_name])
285
+ }
286
+ elsif options[:CLDEVICE] then
287
+ devices.select!{ |d|
288
+ d.name.match(options[:CLDEVICE])
272
289
  }
273
- else
274
- device = devices.first
275
290
  end
291
+ return devices.first
292
+ end
293
+
294
+ def build_opencl(options)
295
+ require 'opencl_ruby_ffi'
296
+ device = select_cl_device(options)
276
297
  @context = OpenCL::create_context([device])
277
298
  program = @context.create_program_with_source([@code.string])
278
299
  opts = options[:CLFLAGS]
@@ -109,7 +109,9 @@ module BOAST
109
109
  # s += self.header(BOAST::get_lang,false)
110
110
  # s += ";\n"
111
111
  if BOAST::get_lang == CL then
112
- if not @properties[:local] then
112
+ if @properties[:local] then
113
+ s += "static "
114
+ else
113
115
  s += "__kernel "
114
116
  wgs = @properties[:reqd_work_group_size]
115
117
  if wgs then
@@ -331,7 +331,7 @@ module BOAST
331
331
  s += ")"
332
332
  end
333
333
  s += " :: #{@name}"
334
- if @constant
334
+ if @constant then
335
335
  s += " = #{@constant}"
336
336
  s += "_wp" if not @dimension and @type and @type.size == 8
337
337
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BOAST
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.999'
4
+ version: '0.9991'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-10 00:00:00.000000000 Z
12
+ date: 2014-08-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: narray