You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
858 B
25 lines
858 B
#ifndef COMMON_H
|
|
#define COMMON_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <limits.h>
|
|
#include <stdbool.h>
|
|
#include <mpi.h>
|
|
|
|
// Avoids aggresive memory reallocation at the beginning of buffer growth sequence
|
|
#define INIT_BUFFER_SIZE 16
|
|
// Optimal exponential buffer growth factor, 2 is sometimes used to
|
|
#define GROWTH_FACTOR 1.5
|
|
// Maximum length of the file that will be read (not applicable to a1)
|
|
#define MAX_LINE_LENGTH 8192
|
|
|
|
void *my_malloc(size_t size);
|
|
void *my_calloc(size_t nitems, size_t size);
|
|
void *my_realloc(void *ptr, size_t size);
|
|
FILE *my_fopen(const char *filename, const char *mode);
|
|
void *buffer_grow(void *ptr, int sizeBufferUsed, int *sizeBufferTotal);
|
|
bool checkParallelWorth(int numProcesses, int sizeBufferUsed);
|
|
void spread_evenly(int numProcesses, int sizeBufferUsed, int **arrBlockIndices, int **arrBlockSizes);
|
|
|
|
#endif
|
|
|