<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

// Determine which loop is parallelized
// 1 - i, 2 - k, 3 - j
// (Default is 'i')
#ifndef PARALLEL_LOOP
# define PARALLEL_LOOP 1
#endif

// Set row/column size
// 1100 is the magic number on my crappy laptop
#define N 100

// Declare arrays
int A[N][N];
int B[N][N];
int C[N][N];

int main(int argc, char *argv[])
{
	int i, j, k, sum;
	struct timeval t0, t1;
	double elapsedTime;

	// Populate A and B with random integers
	int seed = 1234;
	srand(seed);
	for (i=0; i<N; i++) {
		for (j=0; j<N; j++) {
			A[i][j] = rand();
			B[i][j] = rand();
			C[i][j] = 0;
		}
	}

#if PARALLEL_LOOP == 1
// Parallelize the 'i' loop
	char parallel_loop = 'i';
	gettimeofday(&t0, NULL);
	//#pragma omp parallel for private(j,k)
	for (i=0; i<N; i++) {
		for (k=0; k<N; k++) {
			for (j=0; j<N; j++) {
				C[i][j] = C[i][j] + (A[i][k] * B[k][j]);
			}
		}
	}
	gettimeofday(&t1, NULL);
	elapsedTime = t1.tv_sec - t0.tv_sec;

#elif PARALLEL_LOOP == 2
// Parallelize the 'k' loop
	char parallel_loop = 'k';
	gettimeofday(&t0, NULL);
	for (i=0; i<N; i++) {
		#pragma omp parallel for private(j)
		for (k=0; k<N; k++) {
			for (j=0; j<N; j++) {
				#pragma omp critical
				{
					C[i][j] = C[i][j] + (A[i][k] * B[k][j]);<commit_msg>all 3 loops parallelized, no weirdness yet<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

// Determine which loop is parallelized
// 1 - i, 2 - k, 3 - j
// (Default is 'i')
#ifndef PARALLEL_LOOP
# define PARALLEL_LOOP 1
#endif

// Set row/column size
// 1100 is the magic number on my crappy laptop
#define N 100

// Declare arrays
int A[N][N];
int B[N][N];
int C[N][N];

int main(int argc, char *argv[])
{
	int i, j, k, sum;
	struct timeval t0, t1;
	double elapsedTime;

	// Populate A and B with random integers
	int seed = 1234;
	srand(seed);
	for (i=0; i<N; i++) {
		for (j=0; j<N; j++) {
			A[i][j] = rand();
			B[i][j] = rand();
			C[i][j] = 0;
		}
	}

#if PARALLEL_LOOP == 1
// Parallelize the 'i' loop
	char parallel_loop = 'i';
	gettimeofday(&t0, NULL);
	#pragma omp parallel for private(j,k)
	for (i=0; i<N; i++) {
		for (k=0; k<N; k++) {
			for (j=0; j<N; j++) {
				#pragma omp critical
				{
					C[i][j] = C[i][j] + (A[i][k] * B[k][j]);
				}
			}
		}
	}
	gettimeofday(&t1, NULL);
	elapsedTime = t1.tv_sec - t0.tv_sec;

#elif PARALLEL_LOOP == 2
// Parallelize the 'k' loop
	char parallel_loop = 'k';
	gettimeofday(&t0, NULL);
	for (i=0; i<N; i++) {
		#pragma omp parallel for private(j)
		for (k=0; k<N; k++) {
			for (j=0; j<N; j++) {
				#pragma omp critical
				{
					C[i][j] = C[i][j] + (A[i][k] * B[k][j]);
{'fraction_non_alphanumeric': 0.20809685962920924, 'fraction_numerical': 0.02534998108210367, 'mean_word_length': 3.1119751166407466, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 9, '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': '2325225', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1215, 'n_words': 336}