added test cases, skeleton logic for threaded

git-svn-id: svn://anubis/gvsu@176 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-09-27 14:33:48 +00:00
parent a2c1631657
commit 1c3b6ac652
6 changed files with 18 additions and 2 deletions

View File

@ -6,5 +6,12 @@ all: $(PROGS)
%: %.cc
$(CXX) -o $@ -pthread -O3 $<
.PHONY: test
test: all
./sequential e1.*
./threaded e1.*
./sequential e2.*
./sequential e2.*
clean:
-rm -f $(PROGS) *~ *.o

1
cs677/pa2/e1.seq Normal file
View File

@ -0,0 +1 @@
GATATGCA

1
cs677/pa2/e1.unk Normal file
View File

@ -0,0 +1 @@
ATAGCT

1
cs677/pa2/e2.seq Normal file
View File

@ -0,0 +1 @@
AATCGGATTC

1
cs677/pa2/e2.unk Normal file
View File

@ -0,0 +1 @@
GACGGTTCGT

View File

@ -142,6 +142,7 @@ void * calcSimMatrixThread(void * arg)
int id = *realarg;
int s_size = s->size();
int t_size = t->size();
int last_step = s_size + t_size;
int (*F)[s_size][t_size] = (int (*) [s_size][t_size]) matrix;
int max_x = 0, max_y = 0, max_val = 0;
int first_task_id, num_tasks;
@ -152,10 +153,13 @@ void * calcSimMatrixThread(void * arg)
for (int i = 0, idx = first_task_id; i < num_tasks; i++, idx++)
(*F)[idx][0] = 0; /* set first column to 0's */
pthread_barrier_wait(&barrier);
for (int i = 1; i <= s_size; i++)
for (int step = 2; i <= last_step; i++)
{
for (int j = 1; j <= t_size; j++)
/* TODO: figure out how many tasks there are in this step */
/* TODO: call taskAllocate() to get mine */
/* TODO: loop over tasks assigned by taskAllocate() */
{
/* TODO: figure out i, j from step and task */
/* Compute the value for the matrix */
(*F)[i][j] =
max(
@ -187,6 +191,7 @@ void * calcSimMatrixThread(void * arg)
}
}
}
pthread_barrier_wait(&barrier);
}
cout << "Maximum value is " << max_val << " at position ("