Java Code Examples for jcuda.runtime.JCuda#cudaMallocHost()

The following examples show how to use jcuda.runtime.JCuda#cudaMallocHost() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestPointerGetByteBuffer.java    From jcuda with MIT License 5 votes vote down vote up
@Test
public void testGetByteBuffer()
{
    Pointer pointer = new Pointer();
    JCuda.cudaMallocHost(pointer, 1000);
    ByteBuffer byteBuffer = pointer.getByteBuffer();
    
    assertNotNull(byteBuffer);
    assertEquals(0, byteBuffer.position());
    assertEquals(1000, byteBuffer.limit());
}
 
Example 2
Source File: TestPointerGetByteBuffer.java    From jcuda with MIT License 5 votes vote down vote up
@Test
public void testGetByteBufferWithOffsetAndSize()
{
    Pointer pointer = new Pointer();
    JCuda.cudaMallocHost(pointer, 1000);
    ByteBuffer byteBuffer = pointer.getByteBuffer(100, 800);
    
    assertNotNull(byteBuffer);
    assertEquals(0, byteBuffer.position());
    assertEquals(800, byteBuffer.limit());
}
 
Example 3
Source File: TestPointerGetByteBuffer.java    From jcuda with MIT License 5 votes vote down vote up
@Test
public void testGetByteBufferEndianness()
{
    Pointer pointer = new Pointer();
    JCuda.cudaMallocHost(pointer, 1000);
    ByteBuffer byteBuffer = pointer.getByteBuffer(100, 800);
    assertEquals(ByteOrder.nativeOrder(), byteBuffer.order());
}
 
Example 4
Source File: TestPointerGetByteBuffer.java    From jcuda with MIT License 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testGetByteBufferWithInvalidOffset()
{
    Pointer pointer = new Pointer();
    JCuda.cudaMallocHost(pointer, 1000);
    pointer.getByteBuffer(-100, 800);
}
 
Example 5
Source File: TestPointerGetByteBuffer.java    From jcuda with MIT License 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testGetByteBufferWithInvalidSize()
{
    Pointer pointer = new Pointer();
    JCuda.cudaMallocHost(pointer, 1000);
    pointer.getByteBuffer(100, 1000);
}
 
Example 6
Source File: TestPointerGetByteBuffer.java    From jcuda with MIT License 5 votes vote down vote up
@Test(expected = ArithmeticException.class)
public void testGetByteBufferWithOverflow()
{
    Pointer pointer = new Pointer();
    JCuda.cudaMallocHost(pointer, 1000);
    pointer.getByteBuffer(Integer.MAX_VALUE - 10, 20);
}