Tag Archives: parallel
基于windows线程的并行前缀求和
#include #include #include #include #define NUM_THREADS 4 int N = 10000, *A; int intTotals[NUM_THREADS], outTotals[NUM_THREADS]; HANDLE doneStep1[NUM_THREADS]; HANDLE doneStep2; unsigned __stdcall prefixScan(LPVOID pArg) { if(NULL != pArg) { int tNum = *((int*)pArg); int start, end, i; int lPrefixTotal; free(pArg); pArg … Continue reading
基于windows线程的并行线性查找
#include #include #include #include typedef struct{ int * A; int num; int key; int threadID; } sParam; bool Done = FALSE; #define NUM_THREADS 4 void linearSearch(int * A, int s, int e, int key, DWORD *position) { int i; for … Continue reading