[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

#include <iostream> int main() { std::cout<<"hello

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 12
Thread images: 2

#include <iostream>

int main()

{
std::cout<<"hello world!";
}

>>
>>59337833

package magic;
import org.lwjgl.opencl.Util;
import org.lwjgl.opencl.CLMem;
import org.lwjgl.opencl.CLCommandQueue;
import org.lwjgl.BufferUtils;
import org.lwjgl.PointerBuffer;
import org.lwjgl.opencl.CLProgram;
import org.lwjgl.opencl.CLKernel;

import java.nio.IntBuffer;
import java.util.List;

import org.lwjgl.opencl.CL;
import org.lwjgl.opencl.CLContext;
import org.lwjgl.opencl.CLDevice;
import org.lwjgl.opencl.CLPlatform;

import static org.lwjgl.opencl.CL10.*;

public class OpenCLHello {
static String letters = "HeloWrd ";

// The OpenCL kernel
static final String source =
""
+ "kernel void decode(global const int *a, global int *answer) { "
+ " unsigned int xid = get_global_id(0);"
+ " answer[xid] = a[xid] -1;"
+ "}";

// Data buffers to store the input and result data in
static final IntBuffer a = toIntBuffer(new int[]{1, 2, 3, 3, 4, 8, 5, 4, 6, 3, 7});
static final IntBuffer answer = BufferUtils.createIntBuffer(11);

public static void main(String[] args) throws Exception {
// Initialize OpenCL and create a context and command queue
CL.create();
CLPlatform platform = CLPlatform.getPlatforms().get(0);
List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_GPU);
CLContext context = CLContext.create(platform, devices, null, null, null);
CLCommandQueue queue = clCreateCommandQueue(context, devices.get(0), CL_QUEUE_PROFILING_ENABLE, null);

// Allocate memory for our input buffer and our result buffer
CLMem aMem = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, a, null);
clEnqueueWriteBuffer(queue, aMem, 1, 0, a, null, null);

CLMem answerMem = clCreateBuffer(context, CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR, answer, null);
clFinish(queue);
>>
>>59337833
(c_toddler ++) == toddler
>>
File: 9k=.jpg (8KB, 239x210px) Image search: [Google]
9k=.jpg
8KB, 239x210px
>>59337896

  // Create our program and kernel
CLProgram program = clCreateProgramWithSource(context, source, null);
Util.checkCLError(clBuildProgram(program, devices.get(0), "", null));
// sum has to match a kernel method name in the OpenCL source
CLKernel kernel = clCreateKernel(program, "decode", null);

// Execution our kernel
PointerBuffer kernel1DGlobalWorkSize = BufferUtils.createPointerBuffer(1);
kernel1DGlobalWorkSize.put(0, 11);
kernel.setArg(0, aMem);
kernel.setArg(1, answerMem);
clEnqueueNDRangeKernel(queue, kernel, 1, null, kernel1DGlobalWorkSize, null, null, null);

// Read the results memory back into our result buffer
clEnqueueReadBuffer(queue, answerMem, 1, 0, answer, null, null);
clFinish(queue);
// Print the result memory

print(answer);

// Clean up OpenCL resources
clReleaseKernel(kernel);
clReleaseProgram(program);
clReleaseMemObject(aMem);
clReleaseMemObject(answerMem);
clReleaseCommandQueue(queue);
clReleaseContext(context);
CL.destroy();
}


/** Utility method to convert int array to int buffer
* @param ints - the float array to convert
* @return a int buffer containing the input float array
*/
static IntBuffer toIntBuffer(int[] ints) {
IntBuffer buf = BufferUtils.createIntBuffer(ints.length).put(ints);
buf.rewind();
return buf;
}


/** Utility method to print an int buffer as a string in our optimized encoding
* @param answer2 - the int buffer to print to System.out
*/
static void print(IntBuffer answer2) {
for (int i = 0; i < answer2.capacity(); i++) {
System.out.print(letters.charAt(answer2.get(i) ));
}
System.out.println("");
}
>>
#include <iostream>

using namespace std;

int main() {
cout << "hello world!";
}

Fixed
>>
>>59337833
10 PRINT "Hello World!"
20 GOTO 10
>>
>>59337926
This
>>
>>59337926
>using namespace std;
REEEEEEEEEEEEEEEEEEEEEEEE
>>
>>59337896
That code is using obsolete LWJGL 2 API you cuckfag. Doesn't compile on LWJGL 3.
>>
>>59337926
how is this any better?
>>
>>59337833
mov ah 9
mov al 64
int 10

only babbys wont get this meme
>>
var r_pnts = r_bnds.SubRunes
.Where( r => r.Word=="X"|| r.Word=="Y")
.Cast<TokenRune>()
.GroupBy(r => r.Word);
bounds = r_pnts
.First(r => r.Key == "X")
.Zip(
r_pnts.First(r => r.Key == "Y"), (f, s) => new Point(f.Read<int>(), s.Read<int>()) )
.ToArray();
Thread posts: 12
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.