/*
* JCublas - Java bindings for CUBLAS, the NVIDIA CUDA BLAS library,
* to be used with JCuda
* http://www.jcuda.org
*
* Copyright 2009-2011 Marco Hutter - http://www.jcuda.org
*/
import static jcuda.jcublas.JCublas2.*;
import static jcuda.jcublas.cublasPointerMode.*;
import static jcuda.runtime.JCuda.*;
import static jcuda.runtime.cudaMemcpyKind.*;
import jcuda.*;
import jcuda.jcublas.*;
import jcuda.runtime.JCuda;
/**
* A sample demonstrating the different pointer modes for CUBLAS 2.
* With CUBLAS 2, functions may receive pointers as arguments which are
* either used as input parameters or will store results. These pointers
* may either be pointers to host or to device memory. This sample shows
* how to obtain the result of a 'dot' operation in host- or device
* memory.
*/
public class JCublas2PointerModes
{
/**
* Entry point of this sample
*
* @param args Not used
*/
public static void main(String[] args)
{
// Enable exceptions and omit subsequent error checks
JCublas2.setExceptionsEnabled(true);
JCuda.setExceptionsEnabled(true);
// Create the input data: A vector containing the
// value 1.0 exactly n times.
int n = 1000000;
float hostData[] = new float[n];
for (int i=0; i