Skip to content

Commit bc3a6dd

Browse files
committed
Update sample
1 parent de9128a commit bc3a6dd

File tree

1 file changed

+46
-10
lines changed

1 file changed

+46
-10
lines changed

sample/sample.cpp

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,60 @@
44
#include <cla3p/dense.hpp>
55

66
#if !defined(__APPLE__)
7-
#include <culite/types.hpp>
7+
#include <culite/dense.hpp>
88
#endif
99

1010
/*-------------------------------------------------*/
11-
12-
int main()
11+
static void test_omp()
1312
{
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
2114
{
2215
#pragma omp critical
2316
std::cout << "Hello from thread " << omp_get_thread_num() << " / " << omp_get_max_threads() << std::endl;
2417
}
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();
2561

2662
return 0;
2763
}

0 commit comments

Comments
 (0)