|
4 | 4 | #include <cla3p/dense.hpp> |
5 | 5 |
|
6 | 6 | #if !defined(__APPLE__) |
7 | | -#include <culite/types.hpp> |
| 7 | +#include <culite/dense.hpp> |
8 | 8 | #endif |
9 | 9 |
|
10 | 10 | /*-------------------------------------------------*/ |
11 | | - |
12 | | -int main() |
| 11 | +static void test_omp() |
13 | 12 | { |
14 | | - std::cout << "Hello SimuliCore & CLA3P!" << std::endl; |
15 | | - std::cout << "Integer size is: " << sizeof(cla3p::int_t) << std::endl; |
16 | | - |
17 | | - cla3p::dns::RdMatrix A = cla3p::dns::RdMatrix::random(3,3); |
18 | | - std::cout << A.info() << A << std::endl; |
19 | | - |
20 | | -#pragma omp parallel |
| 13 | + #pragma omp parallel |
21 | 14 | { |
22 | 15 | #pragma omp critical |
23 | 16 | std::cout << "Hello from thread " << omp_get_thread_num() << " / " << omp_get_max_threads() << std::endl; |
24 | 17 | } |
| 18 | +} |
| 19 | +/*-------------------------------------------------*/ |
| 20 | +static void test_cla3p() |
| 21 | +{ |
| 22 | + std::cout << "CLA3P Integer size is: " << sizeof(cla3p::int_t) << std::endl; |
| 23 | + |
| 24 | + cla3p::dns::RdMatrix A = cla3p::dns::RdMatrix::random(5,3); |
| 25 | + std::cout << A.info("A") << A << std::endl; |
| 26 | + |
| 27 | + cla3p::dns::RdMatrix At = A.transpose(); |
| 28 | + std::cout << At.info("A transpose") << At << std::endl; |
| 29 | +} |
| 30 | +/*-------------------------------------------------*/ |
| 31 | +static void test_culite() |
| 32 | +{ |
| 33 | +#if !defined(__APPLE__) |
| 34 | + std::cout << "cuLite Integer size is: " << sizeof(culite::int_t) << std::endl; |
| 35 | + |
| 36 | + cla3p::dns::RdMatrix A = cla3p::dns::RdMatrix::random(5,3); |
| 37 | + std::cout << A.info("host A") << A << std::endl; |
| 38 | + |
| 39 | + culite::dns::RdMatrix devA; |
| 40 | + A >> devA; |
| 41 | + std::cout << devA.info("device A") << devA << std::endl; |
| 42 | + |
| 43 | + culite::dns::RdMatrix devAt = devA.transpose(); |
| 44 | + std::cout << devAt.info("device A transpose") << devAt << std::endl; |
| 45 | +#else |
| 46 | + std::cout << "culite is not supported on Apple platforms due to lack of CUDA support." << std::endl; |
| 47 | +#endif |
| 48 | +} |
| 49 | +/*-------------------------------------------------*/ |
| 50 | +static void welcome() |
| 51 | +{ |
| 52 | + std::cout << "Welcome to SimuliCore!" << std::endl; |
| 53 | +} |
| 54 | +/*-------------------------------------------------*/ |
| 55 | +int main() |
| 56 | +{ |
| 57 | + welcome(); |
| 58 | + test_omp(); |
| 59 | + test_cla3p(); |
| 60 | + test_culite(); |
25 | 61 |
|
26 | 62 | return 0; |
27 | 63 | } |
|
0 commit comments