Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import pyopencl as cl
N = 32
its = 3
a = np.random.rand(N).astype(np.float32)
gpu_idx = 0
#include "CL/cl.h"
#include <iostream>
#include <stdexcept>
using namespace std;
string kernelSource = R"(
kernel void _z8setValuePfif(global float* data, long data_offset, int idx, float value) {
data = (global float*)((global char *)data + data_offset);
import numpy as np
import pyopencl as cl
N = 32
its = 3
np.random.seed(123)
a = np.random.rand(N).astype(np.float32)
gpu_idx = 0
#include "EasyCL/EasyCL.h"
#include <iostream>
#include <stdexcept>
using namespace std;
string kernelSource = R"(
kernel void _z8setValuePfif(global float* data, long data_offset, int idx, float value) {
data = (global float*)((global char *)data + data_offset);
#include "EasyCL/EasyCL.h"
#include <iostream>
#include <stdexcept>
#include "cocl/cocl.h"
using namespace std;
string kernelSource = R"(
#include "EasyCL/EasyCL.h"
#include <iostream>
#include <stdexcept>
#include "cocl/cocl.h"
using namespace std;
string kernelSource = R"(
#include "EasyCL/EasyCL.h"
#include <iostream>
#include <stdexcept>
#include "cocl/cocl.h"
using namespace std;
string kernelSource = R"(
#include "EasyCL/EasyCL.h"
#include <iostream>
#include <stdexcept>
#include "cocl/cocl.h"
using namespace std;
string kernelSource = R"(
#include "EasyCL/EasyCL.h"
#include <iostream>
#include <stdexcept>
#include <cstddef>
#include "cocl/cocl.h"
using namespace std;
#include "EasyCL/EasyCL.h"
#include <iostream>
#include <stdexcept>
#include <cstddef>
#include "cocl/cocl.h"
using namespace std;