Esempio n. 1
0
 /// <summary>
 /// Allocates a new exchange buffer that allocates the specified amount of elements
 /// on the current accelerator. Furthermore, it keeps a buffer of the same size in pinned
 /// CPU memory to enable async memory transfers between the CPU and the GPU.
 /// </summary>
 /// <typeparam name="T">The element type.</typeparam>
 /// <param name="accelerator">The associated acclerator to use.</param>
 /// <param name="extent">The extent (number of elements to allocate).</param>
 /// <returns>The allocated exchange buffer.</returns>
 /// <remarks>
 /// This function uses the default buffer allocation mode
 /// <see cref="ExchangeBufferMode.PreferPagedLockedMemory"/>
 /// </remarks>
 public static ExchangeBuffer <T> AllocateExchangeBuffer <T>(
     this Accelerator accelerator,
     Index extent)
     where T : struct =>
 accelerator.AllocateExchangeBuffer <T>(
     extent,
     ExchangeBufferMode.PreferPagedLockedMemory);
Esempio n. 2
0
 /// <summary>
 /// Allocates an exchange buffer using the mode
 /// <see cref="ExchangeBufferMode.PreferPageLockedMemory"/>
 /// </summary>
 /// <typeparam name="T">The element type.</typeparam>
 /// <param name="accelerator">The accelerator instance.</param>
 /// <param name="length">The number of elements to allocate.</param>
 /// <returns>The allocated exchange mode.</returns>
 public static ExchangeBuffer <T> AllocateExchangeBuffer <T>(
     this Accelerator accelerator,
     long length)
     where T : unmanaged =>
 accelerator.AllocateExchangeBuffer <T>(
     length,
     ExchangeBufferMode.PreferPageLockedMemory);