<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

#include "carbon_user.h"
#include "capi.h"
#include "sync_api.h"

// #define DEBUG 1
#define NUM_ITERS 5
#define SWAP(a,b,t)  (((t) = (a)), ((a) = (b)), ((b) = (t)))

// Global Variables
float** g_old_array;
float** g_new_array;

SInt32 num_cores;
SInt32 _2d_array_size_per_core;
SInt32 _2d_array_size;

carbon_barrier_t jacobi_barrier;

#ifdef DEBUG
pthread_mutex_t print_lock;
#endif

void* threadMain(void*);
void printElements(SInt32);

int main (int argc, char* argv[])
{
   CarbonStartSim(argc, argv);

   if (argc != 3)
   {
      fprintf(stderr, "[Usage]: ./jacobi <Number of Threads> <2-d array size per Thread>\n");
      exit(-1);
   }

   printf("Starting 2d-jacobi relaxation..\n");

   num_cores = atoi(argv[1]);
   _2d_array_size_per_core = atoi(argv[2]);
   _2d_array_size = sqrt(num_cores) * _2d_array_size_per_core;

   // Allocate the storage space
   g_old_array = (float**) malloc((_2d_array_size+2) * sizeof(float*));
   g_new_array = (float**) malloc((_2d_array_size+2) * sizeof(float*));
   for (SInt32 i = 0; i < _2d_array_size+2; i++)
   {
      g_old_array[i] = (float*) malloc((_2d_array_size+2) * sizeof(float));
      g_new_array[i] = (float*) malloc((_2d_array_size+2) * sizeof(float));

      for (SInt32 j = 0; j < _2d_array_size+2; j++)
      {
         g_old_array[i][j] = 0.0;
         g_new_array[i][j] = 0.0;
      }
   }

   // Initialize to the correct value<commit_msg>[tests/2d_jacobi] Fix command line checking to support running without pin.<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

#include "carbon_user.h"
#include "capi.h"
#include "sync_api.h"

// #define DEBUG 1
#define NUM_ITERS 5
#define SWAP(a,b,t)  (((t) = (a)), ((a) = (b)), ((b) = (t)))

// Global Variables
float** g_old_array;
float** g_new_array;

SInt32 num_cores;
SInt32 _2d_array_size_per_core;
SInt32 _2d_array_size;

carbon_barrier_t jacobi_barrier;

#ifdef DEBUG
pthread_mutex_t print_lock;
#endif

void* threadMain(void*);
void printElements(SInt32);

int main (int argc, char* argv[])
{
   CarbonStartSim(argc, argv);

/*    if (argc != 3) */
/*    { */
/*       fprintf(stderr, "[Usage]: ./jacobi <Number of Threads> <2-d array size per Thread>\n"); */
/*       exit(-1); */
/*    } */

   printf("Starting 2d-jacobi relaxation..\n");

   num_cores = atoi(argv[1]);
   _2d_array_size_per_core = atoi(argv[2]);
   _2d_array_size = sqrt(num_cores) * _2d_array_size_per_core;

   // Allocate the storage space
   g_old_array = (float**) malloc((_2d_array_size+2) * sizeof(float*));
   g_new_array = (float**) malloc((_2d_array_size+2) * sizeof(float*));
   for (SInt32 i = 0; i < _2d_array_size+2; i++)
   {
      g_old_array[i] = (float*) malloc((_2d_array_size+2) * sizeof(float));
      g_new_array[i] = (float*) malloc((_2d_array_size+2) * sizeof(float));

      for (SInt32 j = 0; j < _2d_array_size+2; j++)
      {
         g_old_array[i][j] = 0.0;
         g_new_array[i][j] = 0.0;
      }
   }

   // Initialize to the correct value
{'fraction_non_alphanumeric': 0.17080943275971958, 'fraction_numerical': 0.027724665391969407, 'mean_word_length': 3.8441358024691357, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, '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': '4608319', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1277, 'n_words': 266}