All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aparapi.examples.configuration.KernelWithAlternateFallbackAlgorithm Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
/**
 * 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)");
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy