This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <unistd.h> | |
#include "RCCE.h" | |
#include "RCCE_lib.h" | |
#define WORKER(i) if (RCCE_ue() == (i)) | |
static int *fool_wcb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef TIMER_H | |
#define TIMER_H | |
#define CYCLES_PER_SEC(t) ((t) * 1e9) | |
#define CYCLES_PER_MSEC(t) ((t) * 1e6) | |
#define CYCLES_PER_USEC(t) ((t) * 1e3) | |
typedef struct timer { | |
unsigned long long start, end; | |
unsigned long long elapsed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Calculate the average of a series of numbers | |
n=0 | |
while read number; do | |
echo $number | |
numbers+=$number"+" | |
n=$((n+1)) | |
done | |
numbers+="0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SCC | |
static int topology[48][10] = | |
{ | |
/* Core 00 */ { 5, 1, 2, 3, 12, 13 }, | |
/* Core 01 */ { 5, 0, 2, 3, 12, 13 }, | |
/* Core 02 */ { 7, 0, 1, 3, 4, 5, 14, 15 }, | |
/* Core 03 */ { 7, 0, 1, 2, 4, 5, 14, 15 }, | |
/* Core 04 */ { 7, 2, 3, 5, 6, 7, 16, 17 }, | |
/* Core 05 */ { 7, 2, 3, 4, 6, 7, 16, 17 }, | |
/* Core 06 */ { 7, 4, 5, 7, 8, 9, 18, 19 }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef WTIME_H | |
#define WTIME_H | |
#include <sys/time.h> | |
#include <time.h> | |
// Seconds, milliseconds, or microseconds since the Epoch | |
static inline double wtime_sec(void) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <omp.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 2) exit(0); | |
#pragma omp parallel num_threads(4) | |
printf("Thread %d says %s\n", omp_get_thread_num(), argv[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <omp.h> | |
int main(void) | |
{ | |
#pragma omp parallel num_threads(4) | |
{ | |
printf("%d: Hello outer parallel region!\n", omp_get_thread_num()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <omp.h> | |
void do_sth(void) { return; } | |
int main(void) | |
{ | |
int i, n = 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <omp.h> | |
void do_sth_else(void) { return; } | |
int main(void) | |
{ | |
int i, n = 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <omp.h> | |
int main(void) | |
{ | |
int s, a = 4, b = 2; | |
#pragma omp task shared(s) | |
s = a + b; |