-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (30 loc) · 707 Bytes
/
main.cpp
File metadata and controls
39 lines (30 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <sys/time.h>
#include <math.h>
#ifdef MPI_USE
#include <mpi.h>
#endif
#include "src/utils.h"
using namespace std;
/*
argv[1] b: the right-hand vector b file
*/
int main(int argc, char **argv) {
// load vector from file
cout << "load vector from file" << endl;
int n = 9104256;
double *vec = new double[n];
// parse arguments
char* b_file = strdup(argv[1]);
load_vector(n ,vec, b_file);
// print vector (first 10 elements)
for (int i = 0; i < 10; i++) {
fprintf(stdout, "vec[%d] = %lf\n", i, vec[i]);
}
// get memory usageV
MemUsage();
// free memory
delete[] vec;
free(b_file);
return 0;
}