Skip to content

Instantly share code, notes, and snippets.

extern "C" __global__
void add_vec( const float* A, const float* B, const int length float* result) {
int x = blockIdx.x * blockDim.x + threadIdx.x;
if (x < length) {
result[x] = A[x] + B[x];
}
}
import jcuda.utils.KernelLauncher;
import jcuda.driver.CUdeviceptr;
import jcuda.runtime.JCuda;
public class Main {
public static void main(String[] args) {
float[] a = new float[] {1, 2, 3, 4]
float[] b = new float[] {1, 2, 3, 4]
CUdeviceptr devA = new CUdeviceptr();
CUdeviceptr devB = new CUdeviceptr();
CUdeviceptr devR = new CUdeviceptr();
<h:form>
<notify:notifyMessages for="number1" stack="topRightStack" ajaxRendered="true" />
<notify:notifyMessages for="number2" stack="bottomRightStack" ajaxRendered="true" />
<notify:notify sticky="false" stayTime="5000" title="Stack 1" text="Details of the message" stack="topRightStack"/>
<notify:notify sticky="false" stayTime="5000" title="Stack 2" text="Details of the message" stack="bottomRightStack"/>
<notify:notifyStack id="topRightStack" styleClass="topRight" stackDir1="up" stackDir2="left" push="bottom"/>
<notify:notifyStack id="bottomRightStack" styleClass="bottomRight" stackDir1="up" stackDir2="left" push="bottom"/>
<h:form>
<notify:notifyMessages for="number1" stack="topRightStack" ajaxRendered="true" />
<notify:notifyMessages for="number2" stack="bottomRightStack" ajaxRendered="true" />
<notify:notify sticky="false" stayTime="5000" title="Stack 1" detail="Details of the message" stack="topRightStack"/>
<notify:notify sticky="false" stayTime="5000" title="Stack 2" detail="Details of the message" stack="bottomRightStack"/>
<notify:notifyStack id="topRightStack" styleClass="topRight" stackDir1="up" stackDir2="left" push="bottom"/>
<notify:notifyStack id="bottomRightStack" styleClass="bottomRight" stackDir1="up" stackDir2="left" push="bottom"/>
@papousek
papousek / gist:1940514
Created February 29, 2012 12:37
mvn clean verify -Pjbossas-managed-7 -Dtest=autocomplete.*
rg.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:188)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:166)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:101)
@papousek
papousek / Deployer.java
Created June 27, 2012 07:25
More Test Classes with One Deployment
@RunWith(ArquilliianSuite.class)
@Sub(groups = { "group1" }, classes = { ExampleTest1.class, ExampleTest2.class })
pulic class Deployer {
...
}
@papousek
papousek / gist:3088879
Created July 11, 2012 08:11
Opera and Reusable Session
-------------------------------------------------------------------------------
Test set: org.jboss.arquillian.drone.webdriver.example.WebDriverTestCase
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.303 sec <<< FAILURE!
org.jboss.arquillian.drone.webdriver.example.WebDriverTestCase Time elapsed: 0 sec <<< ERROR!
org.openqa.selenium.WebDriverException: Address already in use
Command duration or timeout: 1.50 seconds
Build info: version: '2.24.1', revision: '17205', time: '2012-06-19 15:28:49'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.43.8-1.fc15.x86_64', java.version: '1.7.0_04'
Driver info: driver.version: RemoteWebDriver
@papousek
papousek / gist:3705383
Created September 12, 2012 08:58
new richfaces build
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.richfaces:richfaces-resources-maven-plugin:4.3.0-SNAPSHOT (/home/jpapouse/workspace/richfaces/richfaces/resources-plugin/pom.xml) has 2 errors
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.el:jboss-el-api_2.2_spec:jar is missing. @ line 61, column 21
[ERROR] 'dependencies.dependency.version' for org.richfaces:richfaces-framework:jar is missing. @ line 73, column 21
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
@papousek
papousek / gist:3979464
Created October 30, 2012 10:20
rich:tree and rowKeyConverter
<rich:tree var="node" value="#{treeRoot}" rowKeyConverter="#{treeNodeConverter}">
<rich:treeNode>
<h:outputText value="#{node}" />
</rich:treeNode>
</rich:tree>
@papousek
papousek / gist:4016767
Created November 5, 2012 11:29
GrapheneContext
public static WebDriver getWebDriverProxy() {
return getProxy(WebDriver.class);
}
public static WebDriver getWebDriverProxyForInterfaces(Class<?>... interfaces) {
return getProxyForInterfaces(WebDriver.class, interfaces);
}
public static GrapheneConfiguration getConfigurationProxy() {
return getProxy(GrapheneConfiguration.class);