<commit_before>R"(

__constant const float G = 6.67408e-11f * 1e10f;
__constant const float Geps = 1e-1f;

static float3 grav_accel(float3 delta, float mass) {
	float l = length(delta);
	float d = l*l + Geps * Geps;

	return (float)-G * mass / d / l * delta;
}

__kernel void gr_step(
		const int N,
		const float dt,
		const float ratio,

		__global const float3 *p0,
		__global const float3 *v0,
		__global const float3 *p1,
		__global const float3 *v1,

		__global const float *m,
		__global const uchar *active,

		__global float3 *p2,
		__global float3 *v2,
		__global float3 *va,
		__global float3 *aa
		) {

	const int i = get_global_id(0);

	if(i >= N) return;
	if(!active[i]) return;

	float3 pos = p1[i];

	float3 acc = (float3)(.0f, .0f, .0f);
	for(int j = 0; j < N; j++) {
		if(i == j || !active[j]) continue;

		acc += grav_accel(pos - p1[j], m[j]);
	}

	p2[i] = p0[i] + v1[i] * dt;
	v2[i] = v0[i] + acc * dt;

	va[i] += v0[i] * ratio;
	aa[i] += acc * ratio;
}

__kernel void gr_end(
		const int N,
		const float dt,
		__global const bool *active,

		__global const float *va,
		__global const float *aa,

		__global float3 *pos,
		__global float3 *vel
		) {

	const int i = get_global_id(0);

	if(i >= N) return;
	if(!active[i]) return;

	pos[i] = pos[i] + dt * va[i] / 6.0f;<commit_msg>fixed float -> float3 in a kernel<commit_after>R"(

__constant const float G = 6.67408e-11f * 1e10f;
__constant const float Geps = 1e-1f;

static float3 grav_accel(float3 delta, float mass) {
	float l = length(delta);
	float d = l*l + Geps * Geps;

	return (float)-G * mass / d / l * delta;
}

__kernel void gr_step(
		const int N,
		const float dt,
		const float ratio,

		__global const float3 *p0,
		__global const float3 *v0,
		__global const float3 *p1,
		__global const float3 *v1,

		__global const float *m,
		__global const uchar *active,

		__global float3 *p2,
		__global float3 *v2,
		__global float3 *va,
		__global float3 *aa
		) {

	const int i = get_global_id(0);

	if(i >= N) return;
	if(!active[i]) return;

	float3 pos = p1[i];

	float3 acc = (float3)(.0f, .0f, .0f);
	for(int j = 0; j < N; j++) {
		if(i == j || !active[j]) continue;

		acc += grav_accel(pos - p1[j], m[j]);
	}

	p2[i] = p0[i] + v1[i] * dt;
	v2[i] = v0[i] + acc * dt;

	va[i] += v0[i] * ratio;
	aa[i] += acc * ratio;
}

__kernel void gr_end(
		const int N,
		const float dt,
		__global const bool *active,

		__global const float3 *va,
		__global const float3 *aa,

		__global float3 *pos,
		__global float3 *vel
		) {

	const int i = get_global_id(0);

	if(i >= N) return;
	if(!active[i]) return;

	pos[i] = pos[i] + dt * va[i] / 6.0f;
{'fraction_non_alphanumeric': 0.14939024390243902, 'fraction_numerical': 0.039253048780487805, 'mean_word_length': 3.193290734824281, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '3708037', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1114, 'n_words': 336}