com.aparapi.examples.configuration.KernelWithAlternateFallbackAlgorithm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aparapi-examples Show documentation
Show all versions of aparapi-examples Show documentation
A collection of examples for the aparapi framework.
/**
* This product currently only contains code developed by authors
* of specific components, as identified by the source code files.
*
* Since product implements StAX API, it has dependencies to StAX API
* classes.
*
* For additional credits (generally to people who reported problems)
* see CREDITS file.
*/
package com.aparapi.examples.configuration;
import com.aparapi.*;
/**
* Kernel which will always fail to run on an OpenCLDevice but has an alternative fallback algorithm.
*/
public class KernelWithAlternateFallbackAlgorithm extends Kernel {
@Override
public void run() {
// deliberately, will fail to generate OpenCL as println is unsupported
System.out.println("Running in Java (regular algorithm)");
}
@Override
public boolean hasFallbackAlgorithm() {
return true;
}
@Override
public void executeFallbackAlgorithm(Range _range, int _passes) {
System.out.println("Running in Java (alternate non-parallel algorithm)");
}
}