forked from claudioscordino/jiajia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Claudio Scordino
committed
May 7, 2015
0 parents
commit 835c8db
Showing
142 changed files
with
15,012 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
************************************************************ | ||
* * | ||
* The JIAJIA Software Distributed Shared Memory System * | ||
* * | ||
* Copyright (C) 1997 the Center of High Performance Computing * | ||
* of Institute of Computing Technology, Chinese Academy of * | ||
* Scieneces. All rights reserved. * | ||
* * | ||
* Permission to use, copy, modify and distribute this software * | ||
* is hereby granted provided that (1) source code retains these * | ||
* copyright, permission, and disclaimer notices, and (2) redistri- * | ||
* butions including binaries reproduce the notices in supporting * | ||
* documentation, and (3) all advertising materials mentioning * | ||
* features or use of this software display the following * | ||
* acknowledgement: ``This product includes software developed by * | ||
* the Center of High Performance Computing, Institute of Computing * | ||
* Technology, Chinese Academy of Scieneces." * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * | ||
* * | ||
* Center of High Performance Computing requests users of this * | ||
* software to return to [email protected] any * | ||
* improvements that they make and grant CHPC redistribution rights. * | ||
* * | ||
* Author: Weiwu Hu, Weisong Shi, Zhimin Tang * | ||
* Web-page: http://www-users.cs.umn.edu/~tianhe/paper/dist.htm * | ||
* * | ||
**********************************************************************/ | ||
|
||
1) Read the docs! | ||
|
||
2) This is still an early release, so please be prepared for configuration | ||
problems and/or bugs. | ||
|
||
3) Please send any source changes/new protocols that you think might be of | ||
general use to me so that I can fold them back into the next distribution. | ||
|
||
|
||
============================================================================= | ||
Installing JIAJIA | ||
============================================================================= | ||
Currently, JIAJIA can be compiled by GNU gcc compiler or SUN cc compiler. | ||
|
||
Please let me know if this does not work for anyone, and what *does* work | ||
for you if this does not. | ||
|
||
Before running any programs, set up your .jiahosts file at the directory of | ||
your applications. starting with the host that you start on. | ||
|
||
|
||
============================================================================= | ||
[email protected] (please include 'JIAJIA' in the subject line of all mail) | ||
============================================================================= | ||
|
||
|
||
|
||
Weisong Shi | ||
|
||
Center of High Performance Computing | ||
Institute of Computing Technology | ||
Chinese Academy of Sciences | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#********************************************************* | ||
# Application specific rules and defines... | ||
#********************************************************* | ||
|
||
CPPFLAGS = -I../../../src -O2 | ||
|
||
OBJS = ep.o | ||
VPATH = ../src | ||
JIALIB = ../../../lib/$(ARCH) | ||
|
||
%.d:%.c | ||
@echo "Creating $@..." | ||
@$(SHELL) -ec "$(CC) $(CPPFLAGS) $< | sed ' s/$*\.o/& $@/g' > $@" | ||
|
||
TARGET = ../EP.$(ARCH) | ||
|
||
$(TARGET):$(OBJS) $(JIALIB)/libjia.a | ||
$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(JIALIB) -ljia $(LDFLAGS) | ||
|
||
all:$(TARGET) | ||
|
||
clean: | ||
rm -f *.[od] *.log *.err $(TARGET) | ||
|
||
include $(OBJS:.o=.d) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#********************************************************* | ||
# Platform dependent rules and defines... | ||
#********************************************************* | ||
|
||
CC = gcc | ||
CFLAGS = | ||
|
||
ARCH = aix41 | ||
LDFLAGS = -lm -lbsd # ALWAYS link math lib first!.RE: pow() man page | ||
# bsd is required for valloc/malloc/... | ||
|
||
include ../Makefile.common |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#********************************************************* | ||
# Platform dependent rules and defines... | ||
#********************************************************* | ||
|
||
CC = cc | ||
#CFLAGS = -dn | ||
|
||
ARCH = solaris | ||
LDFLAGS = -lnsl -lsocket -lcurses -lucb -lm | ||
|
||
include ../Makefile.common |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#********************************************************* | ||
# Platform dependent rules and defines... | ||
#********************************************************* | ||
|
||
CC = cc | ||
#CFLAGS = -dn | ||
|
||
ARCH = solaris | ||
LDFLAGS = -lnsl -lsocket -lcurses -lucb -lm | ||
|
||
include ../Makefile.common |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
#include <stdio.h> | ||
#include <math.h> | ||
#include <sys/time.h> | ||
#include <jia.h> | ||
|
||
double aint(double x) | ||
{ | ||
if (x > 0.0) | ||
return floor(x); | ||
else | ||
return ceil(x); | ||
} | ||
|
||
unsigned int M=0; /*#define M 28*/ | ||
#define MK 10 | ||
unsigned int MM; /*#define MM (M - MK) */ | ||
unsigned int NN; /*#define NN (1 << MM) */ /* 2 ** MM */ | ||
unsigned int NK; /*#define NK (1 << MK) */ /* 2 ** MK */ | ||
#define NQ 10 | ||
#define A 1220703125.0 | ||
#define S 271828183.0 | ||
|
||
extern char *optarg; | ||
int *shared; | ||
|
||
main(argc, argv) | ||
int argc; | ||
char **argv; | ||
{ | ||
double half23 = 1.0, half46 = 1.0, two23 = 1.0, two46 = 1.0; | ||
double a_to_n; | ||
double a1, a2, b1, b2; | ||
double t1, t2, t3, t4, t5; | ||
double seed, temp; | ||
double x1, x2; | ||
int extra, len; | ||
int count[NQ+1] = {0}; | ||
int i, j, k, c; | ||
int begin, end; | ||
|
||
struct timeval start, stop; | ||
|
||
|
||
while ((c = getopt(argc, argv, "m:")) != -1) | ||
switch (c) { | ||
case 'm': | ||
M = atoi(optarg); | ||
break; | ||
} | ||
|
||
if (!M) | ||
M = 28; | ||
|
||
MM = M - MK; | ||
NN = 1 << MM; | ||
NK = 1 << MK; | ||
|
||
jia_init(argc, argv); | ||
|
||
shared = (int *) jia_alloc((NQ+1) * sizeof(int)); | ||
jia_barrier(); | ||
if (jiapid==0) { | ||
bzero(shared, (NQ+1) * sizeof(int)); | ||
} | ||
jia_barrier(); | ||
|
||
/*bzero(&Tmk_stat, sizeof(Tmk_stat));*/ | ||
|
||
/* compute (1/2)^23, (1/2)^46, 2^23, 2^46 */ | ||
for (i = 23; i > 0; i--) | ||
half23 *= 0.5, half46 *= 0.5 * 0.5, two23 *= 2.0, two46 *= 2.0 * 2.0; | ||
|
||
|
||
/* compute a_to_n */ | ||
a_to_n = A; | ||
for (i = MK; i >= 0; i--) | ||
{ | ||
a1 = aint(half23 * a_to_n); | ||
a2 = a_to_n - two23 * a1; | ||
b1 = aint(half23 * a_to_n); | ||
b2 = a_to_n - two23 * b1; | ||
t1 = a1 * b2 + a2 * b1; | ||
t2 = aint(half23 * t1); | ||
t3 = t1 - two23 * t2; | ||
t4 = two23 * t3 + a2 * b2; | ||
t5 = aint(half46 * t4); | ||
a_to_n = t4 - two46 * t5; | ||
} | ||
|
||
gettimeofday(&start, 0); | ||
len = NN / jiahosts; | ||
extra = NN % jiahosts; | ||
if (jiapid < extra) { | ||
begin = jiapid * (len+1); | ||
end = begin+len+1; | ||
} | ||
else { | ||
begin = jiapid * len + extra; | ||
end = begin+len; | ||
} | ||
|
||
for (j = begin; j < end; j++) | ||
{ | ||
k = j; | ||
seed = S; | ||
temp = a_to_n; | ||
|
||
for (i = 100; i > 0; i--) | ||
{ | ||
if (k & 1) | ||
{ | ||
a1 = aint(half23 * temp); | ||
a2 = temp - two23 * a1; | ||
b1 = aint(half23 * seed); | ||
b2 = seed - two23 * b1; | ||
t1 = a1 * b2 + a2 * b1; | ||
t2 = aint(half23 * t1); | ||
t3 = t1 - two23 * t2; | ||
t4 = two23 * t3 + a2 * b2; | ||
t5 = aint(half46 * t4); | ||
seed = t4 - two46 * t5; | ||
} | ||
if ((k >>= 1) == 0) | ||
break; | ||
{ | ||
a1 = aint(half23 * temp); | ||
a2 = temp - two23 * a1; | ||
b1 = aint(half23 * temp); | ||
b2 = temp - two23 * b1; | ||
t1 = a1 * b2 + a2 * b1; | ||
t2 = aint(half23 * t1); | ||
t3 = t1 - two23 * t2; | ||
t4 = two23 * t3 + a2 * b2; | ||
t5 = aint(half46 * t4); | ||
temp = t4 - two46 * t5; | ||
} | ||
} | ||
|
||
a1 = aint(half23 * A); | ||
a2 = A - two23 * a1; | ||
|
||
for (i = 0; i < NK; i++) | ||
{ | ||
b1 = aint(half23 * seed); | ||
b2 = seed - two23 * b1; | ||
t1 = a1 * b2 + a2 * b1; | ||
t2 = aint(half23 * t1); | ||
t3 = t1 - two23 * t2; | ||
t4 = two23 * t3 + a2 * b2; | ||
t5 = aint(half46 * t4); | ||
seed = t4 - two46 * t5; | ||
x1 = 2.0 * half46 * seed - 1.0; | ||
|
||
b1 = aint(half23 * seed); | ||
b2 = seed - two23 * b1; | ||
t1 = a1 * b2 + a2 * b1; | ||
t2 = aint(half23 * t1); | ||
t3 = t1 - two23 * t2; | ||
t4 = two23 * t3 + a2 * b2; | ||
t5 = aint(half46 * t4); | ||
seed = t4 - two46 * t5; | ||
x2 = 2.0 * half46 * seed - 1.0; | ||
|
||
t1 = x1*x1 + x2*x2; | ||
if (t1 <= 1.0) | ||
{ | ||
t2 = sqrt(-2.0 * log(t1)/t1); | ||
t3 = fabs(x1 * t2); | ||
t4 = fabs(x2 * t2); | ||
count[(int)floor(t3 > t4 ? t3 : t4)]++; | ||
count[NQ]++; | ||
} | ||
} | ||
} | ||
|
||
if (jiahosts > 1) | ||
{ | ||
jia_lock(0); | ||
|
||
for (i = 0; i <= NQ; i++) | ||
shared[i] += count[i]; | ||
|
||
jia_unlock(0); | ||
|
||
jia_barrier(); | ||
} | ||
|
||
else | ||
shared = count; | ||
|
||
gettimeofday(&stop, 0); | ||
|
||
printf("Benchmark 1 Results:\n\nCPU Time = %.3f\nN = 2 ^ %d\nNo. Gaussian Pairs = %d\nCounts:\n", | ||
(stop.tv_sec+stop.tv_usec*1e-6)-(start.tv_sec+start.tv_usec*1e-6), | ||
M, shared[NQ]); | ||
|
||
if (jiapid == 0) | ||
for (i = 0; i < NQ; i++) | ||
printf("%3d\t%12d\n", i, shared[i]); | ||
|
||
jia_exit(); | ||
} |
Oops, something went wrong.