<commit_before>#include <stdio.h>
#include <mpi.h>
#include <unistd.h>

static const int CHAR_BUFFER_SIZE = 1024;
static const int MASTER_ID = 0;
static const int RESULT_HOSTNAME = 0;

void master(const int size) {
  char buffer[CHAR_BUFFER_SIZE];

  for (int n = 0; n < size; n++) {
    MPI_Recv(buffer, CHAR_BUFFER_SIZE, MPI_CHAR, MPI_ANY_SOURCE, RESULT_HOSTNAME, MPI_COMM_WORLD, NULL);
    printf("%s\n", buffer);
  }
}

void slave() {
  char buffer[CHAR_BUFFER_SIZE];
  gethostname(buffer, CHAR_BUFFER_SIZE);

  MPI_Send(buffer, CHAR_BUFFER_SIZE, MPI_CHAR, MASTER_ID, RESULT_HOSTNAME, MPI_COMM_WORLD);
}

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

  MPI_Init(&argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, &size);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);

  if (rank == MASTER_ID) {
    master(size);<commit_msg>use utsname instead of gethostname<commit_after>#include <stdio.h>
#include <mpi.h>
#include <sys/utsname.h>
#include <string.h>

static const int CHAR_BUFFER_SIZE = 1024;
static const int MASTER_ID = 0;
static const int RESULT_HOSTNAME = 0;

void master(const int size) {
  char buffer[CHAR_BUFFER_SIZE];

  for (int n = 0; n < size; n++) {
    MPI_Recv(buffer, CHAR_BUFFER_SIZE, MPI_CHAR, MPI_ANY_SOURCE, RESULT_HOSTNAME, MPI_COMM_WORLD, NULL);
    printf("%s\n", buffer);
  }
}

void slave() {
  struct utsname unameData;
  uname(&unameData);

  char buffer[CHAR_BUFFER_SIZE];
  strcpy(buffer, unameData.nodename);

  MPI_Send(buffer, CHAR_BUFFER_SIZE, MPI_CHAR, MASTER_ID, RESULT_HOSTNAME, MPI_COMM_WORLD);
}

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

  MPI_Init(&argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, &size);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);

  if (rank == MASTER_ID) {
    master(size);
{'fraction_non_alphanumeric': 0.12893982808022922, 'fraction_numerical': 0.008022922636103151, 'mean_word_length': 5.169611307420495, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, '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': '7412098', 'n_tokens_mistral': 731, 'n_tokens_neox': 684, 'n_words': 155}