Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Commit 23fd714

Browse files
authored
Merge pull request #1 from JuliaGPU/sd/tests
make tests pass on CI
2 parents d97e572 + 4bf833d commit 23fd714

File tree

13 files changed

+154
-94
lines changed

13 files changed

+154
-94
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ sudo: false
33

44
os:
55
- linux
6-
- osx
6+
#- osx
77

88
julia:
99
- 0.6

.travis/amd_sdk.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Original script from https://github.com/gregvw/amd_sdk/
4+
5+
# Location from which get nonce and file name from
6+
URL="http://developer.amd.com/tools-and-sdks/opencl-zone/opencl-tools-sdks/amd-accelerated-parallel-processing-app-sdk/"
7+
URLDOWN="http://developer.amd.com/amd-license-agreement-appsdk/"
8+
9+
NONCE1_STRING='name="amd_developer_central_downloads_page_nonce"'
10+
FILE_STRING='name="f"'
11+
POSTID_STRING='name="post_id"'
12+
NONCE2_STRING='name="amd_developer_central_nonce"'
13+
14+
#For newest FORM=`wget -qO - $URL | sed -n '/download-2/,/64-bit/p'`
15+
FORM=`wget -qO - $URL | sed -n '/download-5/,/64-bit/p'`
16+
17+
# Get nonce from form
18+
NONCE1=`echo $FORM | awk -F ${NONCE1_STRING} '{print $2}'`
19+
NONCE1=`echo $NONCE1 | awk -F'"' '{print $2}'`
20+
echo $NONCE1
21+
22+
# get the postid
23+
POSTID=`echo $FORM | awk -F ${POSTID_STRING} '{print $2}'`
24+
POSTID=`echo $POSTID | awk -F'"' '{print $2}'`
25+
echo $POSTID
26+
27+
# get file name
28+
FILE=`echo $FORM | awk -F ${FILE_STRING} '{print $2}'`
29+
FILE=`echo $FILE | awk -F'"' '{print $2}'`
30+
echo $FILE
31+
32+
FORM=`wget -qO - $URLDOWN --post-data "amd_developer_central_downloads_page_nonce=${NONCE1}&f=${FILE}&post_id=${POSTID}"`
33+
34+
NONCE2=`echo $FORM | awk -F ${NONCE2_STRING} '{print $2}'`
35+
NONCE2=`echo $NONCE2 | awk -F'"' '{print $2}'`
36+
echo $NONCE2
37+
38+
wget --content-disposition --trust-server-names $URLDOWN --post-data "amd_developer_central_nonce=${NONCE2}&f=${FILE}" -O AMD-SDK.tar.bz2;

REQUIRE

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
julia 0.6
22

3-
GPUArrays
3+
GPUArrays 0.2.0
44

55
StaticArrays
66
ColorTypes
77

8-
Transpiler 0.3
9-
Sugar 0.3
10-
Matcha 0.0.2
8+
Transpiler 0.4.1
9+
Sugar 0.4.1
10+
Matcha 0.1.1
1111

12-
OpenCL 0.6.0 #proper packed conversion
12+
OpenCL 0.6.1 #proper packed pointer free
1313
CLBLAS 1.1.0
1414
CLFFT 0.4.0 # 0.5.0

src/CLArrays.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ include("array.jl")
1414
include("ondevice.jl")
1515
include("device.jl")
1616
include("context.jl")
17-
include("intrinsics.jl")
1817
include("compilation.jl")
19-
include("mapreduce.jl")
2018
include("3rdparty.jl")
2119

2220
export CLArray, gpu_call

src/array.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ similar(::Type{<: CLArray}, ::Type{T}, size::Base.Dims{N}) where {T, N} = CLArra
4242
function unsafe_free!(a::CLArray)
4343
ptr = pointer(a)
4444
ctxid = context(ptr).id
45-
if cl.is_ctx_id_alive(ctxid) && ctxid != C_NULL
46-
Mem.free(ptr)
45+
err = Mem.free(ptr)
46+
if err == cl.CL_SUCCESS
4747
Mem.current_allocated_mem[] -= sizeof(eltype(a)) * length(a)
48+
elseif err == cl.CL_INVALID_CONTEXT
49+
# ignore (log it!)
50+
else
51+
cl.@check err
4852
end
49-
#TODO logging that we don't free since context is not alive
5053
end
5154

5255
function unsafe_reinterpret(::Type{T}, A::CLArray{ET}, size::NTuple{N, Integer}) where {T, ET, N}

src/compilation.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
using OpenCL: cl
22
using Transpiler: CLMethod, EmptyStruct
33
using Sugar
4-
import GPUArrays: gpu_call, linear_index
4+
import GPUArrays: _gpu_call, linear_index
55
using Transpiler: CLMethod
66
using Sugar: method_nargs, getslots!, isintrinsic, getcodeinfo!, sugared
77
using Sugar: returntype, type_ast, rewrite_ast, newslot!, to_tuple
88
using Sugar: isfunction
99

1010
using Base: tail
1111

12-
function gpu_call(f, A::CLArray, args::Tuple, blocks = nothing, thread = C_NULL)
12+
13+
14+
function _gpu_call(f, A::CLArray, args::Tuple, blocks_threads::Tuple{T, T}) where T <: NTuple{N, Integer} where N
1315
ctx = context(A)
1416
_args = (KernelState(), args...) # CLArrays "state"
1517
clfunc = CLFunction(f, _args, ctx)
16-
if blocks == nothing
17-
blocks, thread = thread_blocks_heuristic(length(A))
18-
elseif isa(blocks, Integer)
19-
blocks = (blocks,)
20-
end
21-
clfunc(_args, blocks, thread)
18+
blocks, threads = blocks_threads
19+
global_size = blocks .* threads
20+
clfunc(_args, global_size, threads)
2221
end
2322

2423

src/context.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ end
1111
function show(io::IO, ctx::CLContext)
1212
println(io, "OpenCL context with:")
1313
println(io, "CL version: ", cl.info(ctx.device, :version))
14-
device_summary(io, ctx.device)
14+
GPUArrays.device_summary(io, ctx.device)
1515
end
1616

1717
function CLContext(device::cl.Device)
@@ -47,7 +47,7 @@ function device(x::cl.Context)
4747
end
4848

4949

50-
50+
global init
5151
let contexts = Dict{cl.Device, CLContext}(), active_device = cl.Device[], clcontext2context = Dict{cl.Context, CLContext}()
5252
function getcontext!(ctx::cl.Context)
5353
if haskey(clcontext2context, ctx)

src/device.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import GPUArrays: supports_double, local_memory
44
function devices()
55
filter(cl.devices()) do dev
66
# These drivers have some problems - TODO figure out if we are the problem
7-
!(
8-
contains(cl.info(dev, :version), "AMD-APP (2348.3)") || #AMD for intel. Why though?
9-
contains(cl.info(dev, :version), "(Build 10)") # intels experimental 2.1 driver
10-
)
7+
!contains(cl.info(dev, :version), "(Build 10)") # intels experimental 2.1 driver
118
end
129
end
1310

src/intrinsics.jl

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/mapreduce.jl

Whitespace-only changes.

0 commit comments

Comments
 (0)