parent
0e4ba6b46b
commit
317d2131d7
@ -1,30 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <ctime>
|
||||
|
||||
#define SIZE 1024
|
||||
|
||||
void inArry(float a[]) {
|
||||
srand(time(NULL));
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
{
|
||||
a[i] = rand() % 100;
|
||||
}
|
||||
}
|
||||
|
||||
void vector_add(float* A, float* B, float* C, int size) {
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
C[i] = A[i] + B[i];
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
float A[SIZE], B[SIZE], C[SIZE];
|
||||
inArry(A);
|
||||
inArry(B);
|
||||
clock_t start = clock();
|
||||
vector_add (A,B,C,SIZE);
|
||||
clock_t end = clock();
|
||||
printf("%f", (double)(end - start) / CLOCKS_PER_SEC);
|
||||
}
|
Loading…
Reference in new issue