Skip to content

Instantly share code, notes, and snippets.

Avatar

Lazar Ljubenović lazarljubenovic

View GitHub Profile
View 2015-09-18-4.c
#include <stdio.h>
#include <mpi.h>
#define W MPI_COMM_WORLD
#define n 4
void printArray(int size, int array[size], int rank) {
for (int i = 0; i < size; i++) {
if (rank == -1) printf("%02d ", array[i]);
else printf("{%d}%02d ", rank, array[i]);
}
View 2016-04-18-4.c
#include <mpi.h>
#include <stdio.h>
#define W MPI_COMM_WORLD
#define n 99999
void printArray(int size, double array[size], int rank) {
for (int i = 0; i < size; i++) {
if (rank == -1) printf("%4.4f ", array[i]);
else printf("{%d}%4.4f ", rank, array[i]);
}
View 2016-04-18-4.c
#include <mpi.h>
#include <stdio.h>
#define W MPI_COMM_WORLD
#define n 99999
void printArray(int size, double array[size], int rank) {
for (int i = 0; i < size; i++) {
if (rank == -1) printf("%4.4f ", array[i]);
else printf("{%d}%4.4f ", rank, array[i]);
}
View 08.09.2016.4.c
#include <stdio.h>
#include <mpi.h>
#define W MPI_COMM_WORLD
#define MPI_SI MPI_STATUS_IGNORE
#define n 6
void printArray(int size, int array[size], int rank) {
for (int i = 0; i < size; i++) {
if (rank == -1) printf("%4d ", array[i]);
else printf("{%d}%4d ", rank, array[i]);
View 08.09.2016.3.c
#include <mpi.h>
#include <stdio.h>
#define W MPI_COMM_WORLD
void printArray(int n, int array[n], int rank) {
for (int i = 0; i < n; i++) {
if (rank == -1) printf("%4d ", array[i]);
else printf("{%d}%4d ", rank, array[i]);
}
printf("\n");
View 24.9.2016.4.c
// 24. 9. 2016 (4)
#include <stdio.h>
#include <mpi.h>
#define W MPI_COMM_WORLD
int q(int i, int j, int m) {
return i * m + j;
}
View 24.9.2016.3.c
// 24. 9. 2016 (3)
#include <stdio.h>
#include <mpi.h>
#define W MPI_COMM_WORLD
int main(int argc, char** argv) {
MPI_Init(&argc, &argv);
int m = 3;