public void Init() { v = (double2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <double2>() * 10000, UnsafeUtility.AlignOf <double2>(), Allocator.Persistent); for (int i = 0; i < 10000; ++i) { v[i] = new double2(1.0f); } }
public void Init() { rng = new Random(1); v = (double2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <double2>() * iterations, UnsafeUtility.AlignOf <double2>(), Allocator.Persistent); for (int i = 0; i < iterations; ++i) { v[i] = new double2(1.0f); } }
public void Init() { rng = (Random *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <Random>() * 10000, UnsafeUtility.AlignOf <Random>(), Allocator.Persistent); for (int i = 0; i < 10000; ++i) { rng[i] = new Unity.Mathematics.Random(1); } f = (double2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <double2>() * 10000, UnsafeUtility.AlignOf <double2>(), Allocator.Persistent); for (int i = 0; i < 10000; ++i) { f[i] = new double2(0.0); } }
/// <summary> /// Creates a new CudaRegisteredHostMemory_double2 from an existing IntPtr. IntPtr must be page size aligned (4KBytes)! /// </summary> /// <param name="hostPointer">must be page size aligned (4KBytes)</param> /// <param name="size">In elements</param> public CudaRegisteredHostMemory_double2(IntPtr hostPointer, SizeT size) { _intPtr = hostPointer; _size = size; _typeSize = (SizeT)Marshal.SizeOf(typeof(double2)); _ptr = (double2*)_intPtr; }