- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm working on migration CUDA version of LULESH application (https://github.com/LLNL/LULESH/tree/2.0.2-dev/cuda) to DPC++. I was able to successfully convert the CUDA version to DPC++ using DPCT tool. However, while compiling the DPC++ version of the code, I am getting the following compilation error: error: no matching constructor for initialization of 'std::vec tor<double>
./vector.h:24:43: error: no matching constructor for initialization of 'std::vec tor<double>'
inline Vector_h(const Vector_d<T> &a) : std::vector<T>(a) {}
^ ~
lulesh.dp.cpp:4908:26: note: in instantiation of member function 'Vector_h<doubl e>::Vector_h' requested here
Vector_h<Real_t> x_h = locDom->x;
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:270:7: note: candidate constructor not viable: no known conversion from 'con st Vector_d<double>' to 'const std::vector<double, std::allocator<double>>::allo cator_type' (aka 'const std::allocator<double>') for 1st argument
vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:283:7: note: candidate constructor not viable: no known conversion from 'con st Vector_d<double>' to 'std::vector::size_type' (aka 'unsigned long') for 1st a rgument
vector(size_type __n, const allocator_type& __a = allocator_type())
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:326:7: note: candidate constructor not viable: no known conversion from 'con st Vector_d<double>' to 'const std::vector<double, std::allocator<double>>' for 1st argument
vector(const vector& __x)
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:344:7: note: candidate constructor not viable: no known conversion from 'con st Vector_d<double>' to 'std::vector<double, std::allocator<double>>' for 1st ar gument
vector(vector&& __x) noexcept
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:383:7: note: candidate constructor not viable: no known conversion from 'con st Vector_d<double>' to 'initializer_list<std::vector<double, std::allocator<dou ble>>::value_type>' (aka 'initializer_list<double>') for 1st argument
vector(initializer_list<value_type> __l,
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:259:7: note: candidate constructor not viable: requires 0 arguments, but 1 w as provided
vector()
^
/glob/development-tools/versions/oneapi/gold/inteloneapi/dpcpp-ct/2021.1.1/inclu de/dpct/dpl_extras/vector.h:69:30: note: candidate function [with OtherA = std:: allocator<double>] not viable: 'this' argument has type 'const Vector_d<double>' , but method is not marked const
template <typename OtherA> operator const std::vector<T, OtherA>() & {
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:348:7: note: candidate constructor not viable: requires 2 arguments, but 1 w as provided
vector(const vector& __x, const allocator_type& __a)
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:358:7: note: candidate constructor not viable: requires 2 arguments, but 1 w as provided
vector(vector&& __rv, const allocator_type& __m)
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:295:7: note: candidate constructor not viable: requires at least 2 arguments , but 1 was provided
vector(size_type __n, const value_type& __value,
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vecto r.h:411:2: note: candidate constructor template not viable: requires at least 2 arguments, but 1 was provided
vector(_InputIterator __first, _InputIterator __last,
^
3 warnings and 1 error generated.
Makefile:13: recipe for target 'lulesh.o' failed
make: *** [lulesh.o] Error 1
I'm not sure if this is an issue with a version of standard library implementation in the devcloud. I'm attaching the makefile and corresponding converted dpc++ files for reference.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
Please share the commands you followed for migrating your cuda code to dpc++. Also, the makefile is not there in the attached documents.
Do send us complete error logs and the version of basekit you are using to migrate the mentioned project.
Warm Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Abhishek,
I have used the following commands to convert the CUDA code to DPC++ version.
intercept-build make
dpct -p compile_commands.json --in-root=./ *.cu
dpct --cuda-include-path=/home/uXXXXX/tkit/include -p compile_commands.json --in-root=./ *.cu
Once the source code is converted into DPC++ format. I have commented out CUDA error-handling API calls which are not converted by DPCT tool. Now I'm left with one error after compilation, as mentioned below:
$ make all
dpcpp -O2 -g -std=c++17 -c lulesh.dp.cpp -o lulesh.o
lulesh.dp.cpp:302:98: warning: data argument not used by format string [-Wformat-extra-args]
fprintf(stderr, "cuda_init(): This implementation of Lulesh requires device SM 3.0+.\n", dev);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
lulesh.dp.cpp:947:19: warning: using '%c' format specifier, but argument has boolean value [-Wformat]
printf("%c\n",fsuccess);//nothing
~~ ^
lulesh.dp.cpp:5056:7: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
delete e_all;
^
[]
lulesh.dp.cpp:5040:23: note: allocated with 'new[]' here
Real_t *e_all = new Real_t[nx * nx];
^
In file included from lulesh.dp.cpp:85:
In file included from ./lulesh.h:3:
./vector.h:25:43: error: no matching constructor for initialization of 'std::vector<double>'
inline Vector_h(const Vector_d<T> &a) : std::vector<T>(a) {}
^ ~
lulesh.dp.cpp:4908:26: note: in instantiation of member function 'Vector_h<double>::Vector_h' requested here
Vector_h<Real_t> x_h = locDom->x;
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:270:7: note: candidate constructor not viable: no known conversion from 'const Vector_d<double>' to 'const std::vector<double, std::allocator<double>>::allocator_type' (aka 'const std::allocator<double>') for 1st argument
vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:283:7: note: candidate constructor not viable: no known conversion from 'const Vector_d<double>' to 'std::vector::size_type' (aka 'unsigned long') for 1st argument
vector(size_type __n, const allocator_type& __a = allocator_type())
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:326:7: note: candidate constructor not viable: no known conversion from 'const Vector_d<double>' to 'const std::vector<double, std::allocator<double>>' for 1st argument
vector(const vector& __x)
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:344:7: note: candidate constructor not viable: no known conversion from 'const Vector_d<double>' to 'std::vector<double, std::allocator<double>>' for 1st argument
vector(vector&& __x) noexcept
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:383:7: note: candidate constructor not viable: no known conversion from 'const Vector_d<double>' to 'initializer_list<std::vector<double, std::allocator<double>>::value_type>' (aka 'initializer_list<double>') for 1st argument
vector(initializer_list<value_type> __l,
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:259:7: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
vector()
^
/glob/development-tools/versions/oneapi/gold/inteloneapi/dpcpp-ct/2021.1.1/include/dpct/dpl_extras/vector.h:69:30: note: candidate function [with OtherA = std::allocator<double>] not viable: 'this' argument has type 'const Vector_d<double>', but method is not marked const
template <typename OtherA> operator const std::vector<T, OtherA>() & {
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:348:7: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
vector(const vector& __x, const allocator_type& __a)
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:358:7: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
vector(vector&& __rv, const allocator_type& __m)
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:295:7: note: candidate constructor not viable: requires at least 2 arguments, but 1 was provided
vector(size_type __n, const value_type& __value,
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:411:2: note: candidate constructor template not viable: requires at least 2 arguments, but 1 was provided
vector(_InputIterator __first, _InputIterator __last,
^
3 warnings and 1 error generated.
Makefile:13: recipe for target 'lulesh.o' failed
make: *** [lulesh.o] Error 1
I couldn't attach the Makefile as the file type is not supported. I'm pasting the content of my Makefile b below:
CXX = dpcpp
CXXFLAGS = -O2 -g -std=c++17
all: lulesh
lulesh: allocator.o lulesh.o lulesh-comms.o lulesh-comms-gpu.o
$(CXX) $(CXXFLAGS) allocator.o lulesh.o lulesh-comms.o lulesh-comms-gpu.o -o luleshexe
allocator.o: allocator.dp.cpp allocator.h
$(CXX) $(CXXFLAGS) -c allocator.dp.cpp -o allocator.o
lulesh.o: lulesh.dp.cpp lulesh.h allocator.h vector.h
$(CXX) $(CXXFLAGS) -c lulesh.dp.cpp -o lulesh.o
lulesh-comms.o: lulesh-comms.dp.cpp lulesh.h
$(CXX) $(CXXFLAGS) -c lulesh-comms.dp.cpp -o lulesh-comms.o
lulesh-comms-gpu.o: lulesh-comms-gpu.dp.cpp lulesh.h
$(CXX) $(CXXFLAGS) -c lulesh-comms-gpu.dp.cpp -o lulesh-comms-gpu.o
clean:
rm ./luleshexe
run:
./luleshexe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We tried the same application and it got migrated successfully. But at the time of compiling migrated codes, we got the same errors as you have sent to us.
We are looking into this issue and will get back to you as soon we get any updates on this issue. Please post back to us if you have any other issues.
Warm Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We tried your application and we feel that it's a bug, so we are forwarding this issue to the concerned team. Thanks for reporting the issue.
Warm Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had a discussion with the Developer. He said: "If you want to inherit the constructors from std::vector, you have to use a 'using' statement." Link: https://en.cppreference.com/w/cpp/language/using_declaration#Inheriting_constructors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Let us know how it goes after you followed the provided link.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We haven't heard back from you and are considering that your issue has been resolved. Thus, we will no longer respond to this thread. If you need additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.
Thanks,
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page