Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compile the cpp file? #30

Open
lihao2333 opened this issue Jun 15, 2018 · 10 comments
Open

How to compile the cpp file? #30

lihao2333 opened this issue Jun 15, 2018 · 10 comments

Comments

@lihao2333
Copy link

Sorry, I'm a new man.
I think I should do something to compile the cpp file to executable file?
Should I need a Makefile?
Thanks

@hughperkins
Copy link
Owner

hughperkins commented Jun 15, 2018 via email

@lihao2333
Copy link
Author

Yes, I did it as instructed. And then source ../dist/bin/easycl_activate.sh to set environment variables. However, if i want to try the testeasycl.cpp, should I run g++ testeasycl.cpp? How could I run this demo?
Thanks very much.

@hughperkins
Copy link
Owner

hughperkins commented Jun 15, 2018 via email

@lihao2333
Copy link
Author

No... there is my tree in dist dir

.
├── bin
│   └── easycl_activate.sh
├── include
│   ├── clew.h
│   └── easycl
│       ├── CLArrayFloat.h
│       ├── CLArray.h
│       ├── CLArrayInt.h
│       ├── CLFloatWrapperConst.h
│       ├── CLFloatWrapper.h
│       ├── CLIntWrapper.h
│       ├── CLKernel.h
│       ├── CLKernel_structs.h
│       ├── CLUCharWrapper.h
│       ├── CLWrapper.h
│       ├── deprecated.h
│       ├── DeviceInfo.h
│       ├── deviceinfo_helper.h
│       ├── DevicesInfo.h
│       ├── EasyCL_export.h
│       ├── EasyCL.h
│       ├── ICLArray.h
│       ├── mystdint.h
│       ├── platforminfo_helper.h
│       ├── templates
│       │   ├── LuaTemplater.h
│       │   └── TemplatedKernel.h
│       └── util
│           ├── easycl_stringhelper.h
│           └── StatefulTimer.h
└── lib
    ├── EasyCL
    │   ├── EasyCL-targets.cmake
    │   └── EasyCL-targets-release.cmake
    ├── libclew.so -> libclew.so.1
    ├── libclew.so.1 -> libclew.so.1.0.0
    ├── libclew.so.1.0.0
    └── libEasyCL.so

What i did is just https://github.com/hughperkins/EasyCL#procedure-1

@lihao2333
Copy link
Author

here is my uname -a
Linux geek-Lenovo-G40-70 4.13.0-45-generic #50~16.04.1-Ubuntu SMP Wed May 30 11:18:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

@hughperkins
Copy link
Owner

hughperkins commented Jun 15, 2018 via email

@lihao2333
Copy link
Author

../dist/bin/easycl_unittests appears~
It works when i run LD_LIBRARY_PATH=../dist/lib ../dist/bin/gpuinfo and LD_LIBRARY_PATH=../dist/lib ../dist/bin/easycl_unittests.
Thank you very much~~
But if I want to test the test/testeasycl.cpp, what should I do ?
I do

g++ test/testeasycl.cpp -std=c++11 -Ithirdparty/gtest -Idist/include/easycl -I/home/geek/Proj/Intel/Install/hld/host/include/ -I.

in the root of this repo. But it not work, it report error like this:

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/cco6nYnD.o: In function `testeasycl_main_Test::TestBody()':
testeasycl.cpp:(.text+0x3f): undefined reference to `easycl::EasyCL::isOpenCLAvailable()'
testeasycl.cpp:(.text+0x8d): undefined reference to `easycl::EasyCL::createForFirstGpuOtherwiseCpu()'
testeasycl.cpp:(.text+0x164): undefined reference to `easycl::EasyCL::buildKernelFromString(std::__cxx11::basic_string<char, std::char_traits<char>, s
td::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_tra
its<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'
testeasycl.cpp:(.text+0x230): undefined reference to `easycl::CLKernel* easycl::CLKernel::input<float>(int, float const*)'
testeasycl.cpp:(.text+0x248): undefined reference to `easycl::CLKernel* easycl::CLKernel::output<float>(int, float*)'
testeasycl.cpp:(.text+0x286): undefined reference to `easycl::CLKernel::run(int, unsigned long const*, unsigned long const*, bool)'
testeasycl.cpp:(.text+0x2a1): undefined reference to `assertEquals(float, int)'
testeasycl.cpp:(.text+0x2bc): undefined reference to `assertEquals(float, int)'

Looking forward to your help

@hughperkins
Copy link
Owner

hughperkins commented Jun 15, 2018 via email

@lihao2333
Copy link
Author

Oh, no wonder, thanks very much.

@hughperkins
Copy link
Owner

hughperkins commented Jun 15, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants