<commit_before>#include <stdio.h>
texture <float4, cudaTextureType3D> dataTex;

int N = 256;

__device__ float3 operator+(const float3 &a, const float3 &b) {
	return make_float3(a.x+b.x, a.y+b.y, a.z+b.z);
}

__device__ float3 operator*(const float &a, const float3 &b) {
	return make_float3(a*b.x, a*b.y, a*b.z);
}

__device__ float4 RK4step(double3* output, double3 loc, double dt ) {
	float4 k1 = tex3D(dataTex, (float3)loc); // of moet ik hier loc.x,loc.y,loc.z meegeven?
	float4 k2 = tex3D(dataTex, (float3)loc+dt*0.5*k1);
	float4 k3 = tex3D(dataTex, (float3)loc+dt*0.5*k2);
	float4 k4 = tex3D(dataTex, (float3)loc+dt*k3);
	return dt/6.0*(k1 + 2.0*((double4)k2 + (double4)k3) + k4);
}


int main(void) {
	cudaArray* dataArray;
	cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32,32,32,32,cudaChannelFormatKindFloat);
	cudaMallocArray(&dataArray, &channelDesc,N,N,N);
	cudaMemcpyToArray(dataArray,0,0,hostpointer,cudaMemcpyHostToDevice);
	cudaBindTextureToArray(dataTex, dataArray, channeldesc);
	nullkernel<<<1,1>>>();
	printf("Hello World!\n");
	return 0;
}<commit_msg>Updated RK4.cu to something that should<commit_after>#include <stdio.h>
texture <float4, cudaTextureType3D> dataTex;

int N = 256;
//Definitions of vectortype operators
__device__ float3 operator+(const float3 &a, const float3 &b) {
	return make_float3(a.x+b.x, a.y+b.y, a.z+b.z);
}

__device__ float3 operator*(const float &a, const float3 &b) {
	return make_float3(a*b.x, a*b.y, a*b.z);
}

__device__ float4 operator+(const float4 &a, const float4 &b) {
	return make_float3(a.x+b.x, a.y+b.y, a.z+b.z, a.w+b.w);
}

__device__ float4 operator*(const float &a, const float4 &b) {
	return make_float3(a*b.x, a*b.y, a*b.z,a*b.w);
}

//Do 1 RK4 step.
__device__ float4 RK4step(float4 loc, double dt ) {
	float4 k1 = tex3D(dataTex, (float3)loc); // of moet ik hier loc.x,loc.y,loc.z meegeven?
	float4 k2 = tex3D(dataTex, (float3)loc+dt*0.5*k1);
	float4 k3 = tex3D(dataTex, (float3)loc+dt*0.5*k2);
	float4 k4 = tex3D(dataTex, (float3)loc+dt*k3);
	return (float4)dt/6.0*(k1 + 2.0*(k2 + k3) + k4);
}

__global__ void RK4line(float4& lineoutput, double dt, unsigned int steps, float4 loc) {
	lineoutput[0] = loc;
	for (unsigned int i=1; i < steps; i++) {
		lineoutput[i] = lineoutput[i-1]+RK4step(lineoutput[i-1],dt);
	}
	return;
}


int main(void) {
	cudaArray* dataArray;
	cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32,32,32,32,cudaChannelFormatKindFloat);
	cudaMallocArray(&dataArray, &channelDesc,N,N,N);
	cudaMemcpyToArray(dataArray,0,0,hostpointer,N*N*N*sizeof(float4), cudaMemcpyHostToDevice);
	cudaBindTextureToArray(dataTex, dataArray, channeldesc);
	float4 *lines;
	int steps = 20;
	int cores = 1;
	int blocks = 1;
	float dt = 1/8.0;
	float4 startloc = {{0}};
	cudaMalloc(&lines,blocks*cores*steps*sizeof(float4));
	RK4line<<<cores,blocks>>>(lines, dt, steps, startloc);
	printf("Hello World!\n");
	return 0;
}
{'fraction_non_alphanumeric': 0.16420474063895568, 'fraction_numerical': 0.0518722088629337, 'mean_word_length': 5.787878787878788, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6361402', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1256, 'n_words': 253}