CUDAMemoryAllocate[type,dim]
指定の型の一次元CUDAMemoryを与える.
CUDAMemoryAllocate[type,{dim1,dim2,…}]
指定の型と次元のCUDAMemoryを与える.
CUDAMemoryAllocate
CUDAMemoryAllocate[type,dim]
指定の型の一次元CUDAMemoryを与える.
CUDAMemoryAllocate[type,{dim1,dim2,…}]
指定の型と次元のCUDAMemoryを与える.
詳細とオプション
- CUDALink パッケージがNeeds["CUDALink`"]でロードされていなければならない.
- CUDAMemoryAllocateに使える型:
-
Integer Real Complex "Byte" "Bit16" "Integer32" "Byte[2]" "Bit16[2]" "Integer32[2]" "Byte[3]" "Bit16[3]" "Integer32[3]" "Byte[4]" "Bit16[4]" "Integer32[4]" "UnsignedByte" "UnsignedBit16" "UnsignedInteger" "UnsignedByte[2]" "UnsignedBit16[2]" "UnsignedInteger[2]" "UnsignedByte[3]" "UnsignedBit16[3]" "UnsignedInteger[3]" "UnsignedByte[4]" "UnsignedBit16[4]" "UnsignedInteger[4]" "Double" "Float" "Integer64" "Double[2]" "Float[2]" "Integer64[2]" "Double[3]" "Float[3]" "Integer64[3]" "Double[4]" "Float[4]" "Integer64[4]" - 以下のオプションが与えられる:
-
"Device" $CUDADevice CUDA計算に使われるデバイス "TargetPrecision" Automatic 計算に使用する精度
例題
すべて開く すべて閉じる例 (4)
Needs["CUDALink`"]mem = CUDAMemoryAllocate[Integer, {10, 10, 10}]CUDAMemoryInformationを使うとメモリについての情報が取り出せる:
CUDAMemoryInformation[mem]CUDAMemoryUnload[mem]CUDAMemoryAllocate[Integer, 10]CUDAMemoryLoadと関連付ける.異なる型がサポートされる:
CUDAMemoryAllocate["Float[4]", {4}]RealあるいはComplexとしてメモリを加えると,デバイスが倍精度をサポートしているかどうかに基づいた型が返される:
CUDAMemoryAllocate[Real, 3]CUDAInformation[$CUDADevice, "Compute Capabilities"]"TargetPrecision"を設定すると,動作の変更を強制することができる:
CUDAMemoryAllocate[Real, 3, "TargetPrecision" -> "Single"]アプリケーション (1)
src = "__global__ void zero(mint * A, mint length) {
int index = threadIdx.x + blockIdx.x*blockDim.x;
if (index < length)
A[index] = 0;
}";len = 100;
mem = CUDAMemoryAllocate[Integer, {len}]zero = CUDAFunctionLoad[src, "zero", {{_Integer}, _Integer}, 32]zero[mem, len]メモリについての情報を示す."DeviceStatus"は"Synchronized"である:
CUDAMemoryInformation[mem]CUDAMemoryGet[mem]メモリについての情報を示す."DeviceStatus"と"HostStatus"は"Synchronized"である:
CUDAMemoryInformation[mem]テクニカルノート
-
▪
- CUDALink ユーザガイド ▪
- メモリ ▪
- CUDAプログラミング
関連するガイド
-
▪
- CUDALink
テキスト
Wolfram Research (2010), CUDAMemoryAllocate, Wolfram言語関数, https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryAllocate.html.
CMS
Wolfram Language. 2010. "CUDAMemoryAllocate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryAllocate.html.
APA
Wolfram Language. (2010). CUDAMemoryAllocate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryAllocate.html
BibTeX
@misc{reference.wolfram_2026_cudamemoryallocate, author="Wolfram Research", title="{CUDAMemoryAllocate}", year="2010", howpublished="\url{https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryAllocate.html}", note=[Accessed: 18-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_cudamemoryallocate, organization={Wolfram Research}, title={CUDAMemoryAllocate}, year={2010}, url={https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryAllocate.html}, note=[Accessed: 18-August-2026]}