int main() { srand (time(0)); int temp; for (int i =0;i<SIZE;i++){ temp=rand() % 10000 + 1; data[i]=temp; data2[i]=temp; } ResetMilli(); bitonic_cpu(data, SIZE); printf("CPU:%f\n", GetSeconds()); ResetMilli(); #ifdef GPU bitonic_gpu(data2, SIZE); printf("GPU:%f\n", GetSeconds()); for (int i=0;i<SIZE;i++) if (data[i] != data2[i]) { printf("Error at %d ", i); return(1); } #endif // Print result if (SIZE <= MAXPRINTSIZE) for (int i=0;i<SIZE;i++) printf("%d ", data[i]); printf("\nYour sorting looks correct!\n"); }
int main() { ResetMilli(); bitonic_cpu(data, SIZE); printf("%f\n", GetSeconds()); ResetMilli(); bitonic_gpu(data2, SIZE); printf("%f\n", GetSeconds()); for (int i=0;i<SIZE;i++) if (data[i] != data2[i]) { printf("Error at %d ", i); return(1); } // Print result if (SIZE <= MAXPRINTSIZE) for (int i=0;i<SIZE;i++) printf("%d ", data[i]); printf("\nYour sorting looks correct!\n"); }