<commit_before>#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <omp.h>

bool IsPrime(unsigned long test_num)
{
	bool is_prime;

	if(test_num != 1)
	{
		is_prime = true;
		float k_max = sqrtf(test_num);

		for(unsigned long k = 2; k <= k_max; k++)
		{
			if(test_num % k == 0)
			{
				is_prime = false;
				break;
			}
		}
	}
	else
	{
		is_prime = false;
	}

	return is_prime;
}

unsigned long prime_count(unsigned long a, unsigned long b, unsigned long num_threads, unsigned long chunk_size)
{
	unsigned long prime_cnt = 0;
	bool test_return = false;

	// Don't evaluate zero
	if(a == 0)
	{
		a += 2;
	}

	// Set number of threads to launch
	omp_set_num_threads(num_threads);

	// Iterate through provided range
	#pragma omp parallel for private(test_return) reduction(+: prime_cnt)
	for(unsigned long i = a; i <= b; i++)
	{
		test_return = IsPrime(i);

		if(test_return == true)
		{
			prime_cnt++;
		}
	}

	return prime_cnt;
}<commit_msg>Forced prime count to schedule dynamic threads with specified chunks (it's faster now)<commit_after>#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <omp.h>

bool IsPrime(unsigned long test_num)
{
	bool is_prime;

	if(test_num != 1)
	{
		is_prime = true;
		float k_max = sqrtf(test_num);

		for(unsigned long k = 2; k <= k_max; k++)
		{
			if(test_num % k == 0)
			{
				is_prime = false;
				break;
			}
		}
	}
	else
	{
		is_prime = false;
	}

	return is_prime;
}

unsigned long prime_count(unsigned long a, unsigned long b, unsigned long num_threads, unsigned long chunk_size)
{
	unsigned long prime_cnt = 0;
	bool test_return = false;

	// Don't evaluate zero
	if(a == 0)
	{
		a += 2;
	}

	// Set number of threads to launch
	omp_set_num_threads(num_threads);

	// Iterate through provided range
	#pragma omp parallel for schedule(dynamic, chunk_size) private(test_return) reduction(+: prime_cnt)
	for(unsigned long i = a; i <= b; i++)
	{
		test_return = IsPrime(i);

		if(test_return == true)
		{
			prime_cnt++;
		}
	}

	return prime_cnt;
}
{'fraction_non_alphanumeric': 0.1254320987654321, 'fraction_numerical': 0.005925925925925926, 'mean_word_length': 3.452747252747253, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, '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': '7567636', 'n_tokens_mistral': 860, 'n_tokens_neox': 766, 'n_words': 212}