sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
934 stars 312 forks source link

OpenCLIdentityMapping.cpp Duplicate Instantiation #1419

Open EmDash00 opened 4 years ago

EmDash00 commented 4 years ago

Build process:

cd ~/Apps/git-apps
git clone https://github.com/sofa-framework/sofa.git
cd sofa/src
git checkout master
mkdir build-master
cd build-master
cmake [options] ..
make

To be clear, build directory is: /home/emdash00/Apps/git-apps/sofa/src/build-master

Edit: updated cmake-log.txt. Last one was the wrong configuration by accident. I tried remaking the config, though it might not be 100% accurate.

I used cmake-gui for the options, so here's the CMakeCache.txt. Here's the configuration process log of the cmake [options] .. command: cmake-log.txt

Output is very long so I've attached it in this text file log.txt

Probably the most notably part is on log.txt:385, which I'll post here.

Note: I spaced it to make it visually easier to read. The original is all on a single line of course.

/home/emdash00/Apps/git-apps/sofa/src/applications/plugins/SofaOpenCL/OpenCLIdentityMapping.cpp:71:16: error: duplicate explicit instantiation of
‘class sofa::component::mapping::IdentityMapping<sofa::gpu::opencl::OpenCLVectorTypes<sofa::defaulttype::Vec<3, float>, 
                                                          sofa::defaulttype::Vec<3, float>, float>,
                                                      sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, float>, 
                                                          sofa::defaulttype::Vec<3, float>, float> >’ [-fpermissive]

I'm unsure of where the original instantiation is. I'm just trying to use the library since Ubuntu 19.10 doesn't have prebuilt packages yet. I don't think this is part of the issue; however, I'm using OpenCL for an Intel GPU. I wasn't sure how computationally intensive this library would be, but I thought might as well try to utilize my Intel HD Graphics Unit.

Here's an attachment of all relevant system specs using linux commands: sysinfo.txt In case of any discrepancy, here's a link to my CPU's spec page as listed by Intel: Intel® Core™ i7-8550U Processor

hugtalbot commented 4 years ago

Hi @EmDash00 Welcome on the SOFA GitHub and thank you for the detailed issue. It helps a lot providing a maximum of information! A recent work in #1361 aimed at updating the OpenCL plugin, which remained inactive for some time. But it led to the duplication of an instantiation.

Removing the line 71 should make it work. If so, could you please contribute this change back?

EmDash00 commented 4 years ago

Hi @EmDash00 Welcome on the SOFA GitHub and thank you for the detailed issue. It helps a lot providing a maximum of information! A recent work in #1361 aimed at updating the OpenCL plugin, which remained inactive for some time. But it led to the duplication of an instantiation.

Removing the line 71 should make it work. If so, could you please contribute this change back?

Hi @hugtalbot, thanks for the quick response. That was the original solution I tried and it seemed to work, but I was skeptical if it was a bandaid over a bigger problem or not. Thank you for confirming. I'd love to make a PR back later today.

hugtalbot commented 4 years ago

Great, looking forward to it!

hugtalbot commented 4 years ago

hey @EmDash00 do not hesitate to let us know whether you need help for contributing Cheers.

EmDash00 commented 4 years ago

hey @EmDash00 do not hesitate to let us know whether you need help for contributing Cheers.

Hey thanks for following up. I was just busy this week. Hoping to get it in by next Wednesday! Sorry for the delays!

hugtalbot commented 4 years ago

No hurry, I just wanted to make sure it wasn't a technical problem! :+1:

EmDash00 commented 4 years ago

No hurry, I just wanted to make sure it wasn't a technical problem! +1

Seems like I'm running into another error.

[ 97%] Linking CXX shared library ../../../lib/libSofaOpenCL.so
/usr/bin/ld: cannot find -lcsparse
collect2: error: ld returned 1 exit status
make[2]: *** [applications/plugins/SofaOpenCL/CMakeFiles/SofaOpenCL.dir/build.make:407: lib/libSofaOpenCL.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:10879: applications/plugins/SofaOpenCL/CMakeFiles/SofaOpenCL.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
hugtalbot commented 4 years ago

Hey @EmDash00 your error shows that you do not properly link with csparse. Do you have it installed?