Skip to content

Commit

Permalink
Fix deprecated typealias syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Feb 16, 2017
1 parent ee01ce1 commit 586320f
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
julia 0.4
Compat 0.9.1
Compat 0.18.0
CUDAdrv
64 changes: 32 additions & 32 deletions gen-6.5/gen_libcudart_h.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const cudaMemAttachSingle = 0x04
const CUDA_IPC_HANDLE_SIZE = 64

# begin enum cudaError
typealias cudaError UInt32
const cudaError = UInt32
const cudaSuccess = (UInt32)(0)
const cudaErrorMissingConfiguration = (UInt32)(1)
const cudaErrorMemoryAllocation = (UInt32)(2)
Expand Down Expand Up @@ -121,7 +121,7 @@ const cudaErrorApiFailureBase = (UInt32)(10000)
# end enum cudaError

# begin enum cudaChannelFormatKind
typealias cudaChannelFormatKind UInt32
const cudaChannelFormatKind = UInt32
const cudaChannelFormatKindSigned = (UInt32)(0)
const cudaChannelFormatKindUnsigned = (UInt32)(1)
const cudaChannelFormatKindFloat = (UInt32)(2)
Expand All @@ -136,21 +136,21 @@ immutable cudaChannelFormatDesc
f::cudaChannelFormatKind
end

typealias cudaArray Void
typealias cudaArray_t Ptr{cudaArray}
typealias cudaArray_const_t Ptr{cudaArray}
typealias cudaMipmappedArray Void
typealias cudaMipmappedArray_t Ptr{cudaMipmappedArray}
typealias cudaMipmappedArray_const_t Ptr{cudaMipmappedArray}
const cudaArray = Void
const cudaArray_t = Ptr{cudaArray}
const cudaArray_const_t = Ptr{cudaArray}
const cudaMipmappedArray = Void
const cudaMipmappedArray_t = Ptr{cudaMipmappedArray}
const cudaMipmappedArray_const_t = Ptr{cudaMipmappedArray}

# begin enum cudaMemoryType
typealias cudaMemoryType UInt32
const cudaMemoryType = UInt32
const cudaMemoryTypeHost = (UInt32)(1)
const cudaMemoryTypeDevice = (UInt32)(2)
# end enum cudaMemoryType

# begin enum cudaMemcpyKind
typealias cudaMemcpyKind UInt32
const cudaMemcpyKind = UInt32
const cudaMemcpyHostToHost = (UInt32)(0)
const cudaMemcpyHostToDevice = (UInt32)(1)
const cudaMemcpyDeviceToHost = (UInt32)(2)
Expand Down Expand Up @@ -200,10 +200,10 @@ immutable cudaMemcpy3DPeerParms
extent::cudaExtent
end

typealias cudaGraphicsResource Void
const cudaGraphicsResource = Void

# begin enum cudaGraphicsRegisterFlags
typealias cudaGraphicsRegisterFlags UInt32
const cudaGraphicsRegisterFlags = UInt32
const cudaGraphicsRegisterFlagsNone = (UInt32)(0)
const cudaGraphicsRegisterFlagsReadOnly = (UInt32)(1)
const cudaGraphicsRegisterFlagsWriteDiscard = (UInt32)(2)
Expand All @@ -212,14 +212,14 @@ const cudaGraphicsRegisterFlagsTextureGather = (UInt32)(8)
# end enum cudaGraphicsRegisterFlags

# begin enum cudaGraphicsMapFlags
typealias cudaGraphicsMapFlags UInt32
const cudaGraphicsMapFlags = UInt32
const cudaGraphicsMapFlagsNone = (UInt32)(0)
const cudaGraphicsMapFlagsReadOnly = (UInt32)(1)
const cudaGraphicsMapFlagsWriteDiscard = (UInt32)(2)
# end enum cudaGraphicsMapFlags

# begin enum cudaGraphicsCubeFace
typealias cudaGraphicsCubeFace UInt32
const cudaGraphicsCubeFace = UInt32
const cudaGraphicsCubeFacePositiveX = (UInt32)(0)
const cudaGraphicsCubeFaceNegativeX = (UInt32)(1)
const cudaGraphicsCubeFacePositiveY = (UInt32)(2)
Expand All @@ -229,15 +229,15 @@ const cudaGraphicsCubeFaceNegativeZ = (UInt32)(5)
# end enum cudaGraphicsCubeFace

# begin enum cudaResourceType
typealias cudaResourceType UInt32
const cudaResourceType = UInt32
const cudaResourceTypeArray = (UInt32)(0)
const cudaResourceTypeMipmappedArray = (UInt32)(1)
const cudaResourceTypeLinear = (UInt32)(2)
const cudaResourceTypePitch2D = (UInt32)(3)
# end enum cudaResourceType

# begin enum cudaResourceViewFormat
typealias cudaResourceViewFormat UInt32
const cudaResourceViewFormat = UInt32
const cudaResViewFormatNone = (UInt32)(0)
const cudaResViewFormatUnsignedChar1 = (UInt32)(1)
const cudaResViewFormatUnsignedChar2 = (UInt32)(2)
Expand Down Expand Up @@ -311,30 +311,30 @@ immutable cudaFuncAttributes
end

# begin enum cudaFuncCache
typealias cudaFuncCache UInt32
const cudaFuncCache = UInt32
const cudaFuncCachePreferNone = (UInt32)(0)
const cudaFuncCachePreferShared = (UInt32)(1)
const cudaFuncCachePreferL1 = (UInt32)(2)
const cudaFuncCachePreferEqual = (UInt32)(3)
# end enum cudaFuncCache

# begin enum cudaSharedMemConfig
typealias cudaSharedMemConfig UInt32
const cudaSharedMemConfig = UInt32
const cudaSharedMemBankSizeDefault = (UInt32)(0)
const cudaSharedMemBankSizeFourByte = (UInt32)(1)
const cudaSharedMemBankSizeEightByte = (UInt32)(2)
# end enum cudaSharedMemConfig

# begin enum cudaComputeMode
typealias cudaComputeMode UInt32
const cudaComputeMode = UInt32
const cudaComputeModeDefault = (UInt32)(0)
const cudaComputeModeExclusive = (UInt32)(1)
const cudaComputeModeProhibited = (UInt32)(2)
const cudaComputeModeExclusiveProcess = (UInt32)(3)
# end enum cudaComputeMode

# begin enum cudaLimit
typealias cudaLimit UInt32
const cudaLimit = UInt32
const cudaLimitStackSize = (UInt32)(0)
const cudaLimitPrintfFifoSize = (UInt32)(1)
const cudaLimitMallocHeapSize = (UInt32)(2)
Expand All @@ -343,13 +343,13 @@ const cudaLimitDevRuntimePendingLaunchCount = (UInt32)(4)
# end enum cudaLimit

# begin enum cudaOutputMode
typealias cudaOutputMode UInt32
const cudaOutputMode = UInt32
const cudaKeyValuePair = (UInt32)(0)
const cudaCSV = (UInt32)(1)
# end enum cudaOutputMode

# begin enum cudaDeviceAttr
typealias cudaDeviceAttr UInt32
const cudaDeviceAttr = UInt32
const cudaDevAttrMaxThreadsPerBlock = (UInt32)(1)
const cudaDevAttrMaxBlockDimX = (UInt32)(2)
const cudaDevAttrMaxBlockDimY = (UInt32)(3)
Expand Down Expand Up @@ -862,15 +862,15 @@ immutable cudaIpcMemHandle_t
reserved::Array_64_Uint8
end

typealias cudaError_t cudaError
typealias CUstream_st Void
typealias cudaStream_t Ptr{CUstream_st}
typealias CUevent_st Void
typealias cudaEvent_t Ptr{CUevent_st}
typealias cudaGraphicsResource_t Ptr{cudaGraphicsResource}
typealias CUuuid_st Void
typealias cudaUUID_t Void
typealias cudaOutputMode_t cudaOutputMode
const cudaError_t = cudaError
const CUstream_st = Void
const cudaStream_t = Ptr{CUstream_st}
const CUevent_st = Void
const cudaEvent_t = Ptr{CUevent_st}
const cudaGraphicsResource_t = Ptr{cudaGraphicsResource}
const CUuuid_st = Void
const cudaUUID_t = Void
const cudaOutputMode_t = cudaOutputMode

immutable char1
x::UInt8
Expand Down Expand Up @@ -1002,4 +1002,4 @@ const CUDART_VERSION = 6050

()

typealias cudaStreamCallback_t Ptr{Void}
const cudaStreamCallback_t = Ptr{Void}
2 changes: 1 addition & 1 deletion gen-6.5/wrap_cuda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function rewriter(ex::Expr)
a3 = ex.args[3]
if isempty(a3.args)
objname = ex.args[2]
return :(typealias $objname Void)
return :(const $objname = Void)
end
end
ex.head == :function || return ex
Expand Down
16 changes: 8 additions & 8 deletions src/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

# Abstract CUDA array types
abstract AbstractCudaArray{T,N}
typealias AbstractCudaVector{T} AbstractCudaArray{T,1}
typealias AbstractCudaMatrix{T} AbstractCudaArray{T,2}
@compat const AbstractCudaVector{T} = AbstractCudaArray{T,1}
@compat const AbstractCudaMatrix{T} = AbstractCudaArray{T,2}

typealias HostOrDevArray{T,N} Union{AbstractArray{T,N}, AbstractCudaArray{T,N}}
@compat const HostOrDevArray{T,N} = Union{AbstractArray{T,N}, AbstractCudaArray{T,N}}

# copy method for AbstractCudaArray
copy(a::AbstractCudaArray; stream=null_stream) = copy!(similar(a),a;stream=stream)
Expand Down Expand Up @@ -37,9 +37,9 @@ else
end

# Vector and matrix aliases
typealias CudaVector{T} CudaArray{T,1}
typealias CudaMatrix{T} CudaArray{T,2}
typealias CudaVecOrMat{T} Union{CudaVector{T}, CudaMatrix{T}}
@compat const CudaVector{T} = CudaArray{T,1}
@compat const CudaMatrix{T} = CudaArray{T,2}
@compat const CudaVecOrMat{T} = Union{CudaVector{T}, CudaMatrix{T}}

# Layout-optimized 1-, 2-, and 3-dimensional arrays
if !debugMemory
Expand Down Expand Up @@ -67,8 +67,8 @@ type HostArray{T,N} <: AbstractArray{T,N}
data::Array{T,N}
end

typealias CdArray{T,N} Union{DenseArray{T,N},HostArray{T,N},AbstractCudaArray{T,N}}
typealias ContiguousArray{T,N} Union{Array{T,N},HostArray{T,N},CudaArray{T,N}}
@compat const CdArray{T,N} = Union{DenseArray{T,N},HostArray{T,N},AbstractCudaArray{T,N}}
@compat const ContiguousArray{T,N} = Union{Array{T,N},HostArray{T,N},CudaArray{T,N}}

###################
# Implementations #
Expand Down
4 changes: 2 additions & 2 deletions src/libcudart-6.5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Compat
# In the runtime API, these are all used only inside Ptrs,
# so these typealiases are safe (if you don't need access to
# struct elements)
typealias cudaUUID_t Void
const cudaUUID_t = Void

function checkerror(code::Cuint)
if code == cudaSuccess
Expand All @@ -20,7 +20,7 @@ end

include("../gen-6.5/gen_libcudart_h.jl")

typealias cudaError_t cudaError
const cudaError_t = cudaError

if is_windows()
# location of cudart64_xx.dll or cudart32_xx.dll have to be in PATH env var
Expand Down
6 changes: 3 additions & 3 deletions src/pointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type CudaPtr{T}
end

# Type alias for previous name
typealias CudaDevicePtr CudaPtr
const CudaDevicePtr = CudaPtr

#############################
# Low-level memory handling #
Expand Down Expand Up @@ -50,8 +50,8 @@ function free{T}(p::CudaPtr{T})
end
end

typealias Ptrs Union{Ptr, CudaPtr, rt.cudaPitchedPtr}
typealias CudaPtrs Union{CudaPtr, rt.cudaPitchedPtr}
const Ptrs = Union{Ptr, CudaPtr, rt.cudaPitchedPtr}
const CudaPtrs = Union{CudaPtr, rt.cudaPitchedPtr}

cudamemcpykind(dstp::Ptr, srcp::Ptr) = rt.cudaMemcpyHostToHost
cudamemcpykind(dstp::CudaPtrs, srcp::Ptr) = rt.cudaMemcpyHostToDevice
Expand Down
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
typealias CudaDims Union{Integer, Tuple{Integer}, Tuple{Integer, Integer}, Tuple{Integer, Integer, Integer}}
const CudaDims = Union{Integer, Tuple{Integer}, Tuple{Integer, Integer}, Tuple{Integer, Integer, Integer}}

const CudaExtent = rt.cudaExtent
CudaExtent(dims::CudaDims) = CudaExtent(get_size_x(dims), get_size_y(dims), get_size_z(dims))
Expand Down

0 comments on commit 586320f

Please sign in to comment.