Package com.jogamp.opencl

Examples of com.jogamp.opencl.CLPlatform


        for (CLDevice device : devices) {

            String name = device.getName();

            CLPlatform platform = device.getPlatform();
            CLPlatform usedPlatform = used.get(name);

            if(usedPlatform == null || platform.equals(usedPlatform)) {
                if(!filtered.containsKey(platform)) {
                    filtered.put(platform, new ArrayList<CLDevice>());
                }
View Full Code Here


            throw new IllegalArgumentException("no devices specified");
        }else if(devices[0] == null) {
            throw new IllegalArgumentException("first device was null");
        }

        CLPlatform platform = devices[0].getPlatform();

        long[] glID = new long[1];
        NativeSizeBuffer properties = setupContextProperties(platform, glContext, glID);
        ErrorDispatcher dispatcher = createErrorHandler();
        long clID = createContext(platform, dispatcher, properties, devices);
View Full Code Here

        initGL();

        out.println(" - - - glcl; createContextTest - - - ");

        CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.glSharing());
        CLDevice device = platform.getMaxFlopsDevice(CLDeviceFilters.glSharing());

        if(device == null) {
            out.println("Aborting test: no GLCL capable devices found.");
            return;
        }else{
View Full Code Here

       
        initGL();
        makeGLCurrent();
        assertTrue(glcontext.isCurrent());
       
        CLPlatform platform = CLPlatform.getDefault(glSharing(glcontext));
        if(platform == null) {
            out.println("test aborted");
            return;
        }
       
        CLDevice theChosenOne = platform.getMaxFlopsDevice(CLDeviceFilters.glSharing());
        out.println(theChosenOne);
       
        CLGLContext context = CLGLContext.create(glcontext, theChosenOne);
       
        try{
View Full Code Here

        TEST_MODE mode = TEST_MODE.QUICK;
        MEMORY memMode = MEMORY.PAGEABLE;
        ACCESS accMode = ACCESS.DIRECT;

        CLPlatform[] platforms = CLPlatform.listCLPlatforms();
        CLPlatform platform = platforms[0];

        // prefere NV
        for (CLPlatform p : platforms) {
            if(p.getICDSuffix().equals("NV")) {
                platform = p;
                break;
            }
        }

        CLDevice device = platform.getMaxFlopsDevice();

        int deviceIndex = -1;
        for (String arg : args) {
            if(arg.startsWith("--access=")) {
                accMode = ACCESS.valueOf(arg.substring(9).toUpperCase());
            }else if(arg.startsWith("--memory=")) {
                memMode = MEMORY.valueOf(arg.substring(9).toUpperCase());
            }else if(arg.startsWith("--device=")) {
                deviceIndex = Integer.parseInt(arg.substring(9).toUpperCase());
            }else if(arg.startsWith("--mode=")) {
                mode = TEST_MODE.valueOf(arg.substring(7).toUpperCase());
            }else if(arg.startsWith("--platform=")) {
                platform = platforms[Integer.parseInt(arg.substring(11))];
            }else{
                System.out.println("unknown arg: "+arg);
                System.exit(1);
            }
        }
        if(deviceIndex != -1) {
            device = platform.listCLDevices()[deviceIndex];
        }

        CLContext context = CLContext.create(device);

        System.out.println();
View Full Code Here

    }
   
    public static void main(String[] args) throws IOException {
       
        // find a CL implementation
        CLPlatform platform = CLPlatform.getDefault(/*type(CPU)*/);
       
        CLContext context = CLContext.create(platform.getMaxFlopsDevice());
       
        try{
            //load and compile program for the chosen device
            CLProgram program = context.createProgram(getStreamFor("Gamma.cl"));
            program.build(CompilerOptions.FAST_RELAXED_MATH);
View Full Code Here

    public RadixSortDemo() throws IOException {

        CLContext context = null;
        try{
            CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.type(GPU));
            if (platform == null) {
                throw new RuntimeException("this demo requires a GPU OpenCL implementation");
            }
           
            //single GPU setup
            context = CLContext.create(platform.getMaxFlopsDevice());
            CLCommandQueue queue = context.getDevices()[0].createCommandQueue();

            int maxValue = Integer.MAX_VALUE;
            int samples  = 10;
View Full Code Here

        }
    }

    private void initCL(GLContext glCtx){
        try {
            CLPlatform platform = CLPlatform.getDefault();
            // SLI on NV platform wasn't very fast (or did not work at all -> CL_INVALID_OPERATION)
            if(platform.getICDSuffix().equals("NV")) {
                clContext = CLGLContext.create(glCtx, platform.getMaxFlopsDevice(GPU));
            }else{
                clContext = CLGLContext.create(glCtx, platform, ALL);
            }
            CLDevice[] devices = clContext.getDevices();
View Full Code Here

TOP

Related Classes of com.jogamp.opencl.CLPlatform

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.