Jak mogę oddzielić kod jądra cuda od innych kodów cpp w projekcie? Chcę zebrać wszystkie definicje jądra w jednym pliku, jak inne pliki cpp wywołujące je w razie potrzeby. Próbowałem napisać wszystkie jądra wewnątrz kernel.cu i wywoływać jądra przez dołączenie pliku kernel.cu, ale daje następujący błąd podczas kompilacji.jak zachować kod jądra w osobnym pliku .cu innym niż główny .cpp?
/usr/bin/ld: error: ./vector_summation.o: multiple definition of
'perform_summation_method1(int*, int)'
/usr/bin/ld: ./kernels.o: previous definition here
/usr/bin/ld: error: ./vector_summation.o: multiple definition of '__device_stub__Z25perform_summation_method1Pii(int*, int)'
/usr/bin/ld: ./kernels.o: previous definition here
/usr/bin/ld: error: ./vector_summation.o: multiple definition of '__device_stub__Z25perform_summation_method2PiS_i(int*, int*, int)'
/usr/bin/ld: ./kernels.o: previous definition here
/usr/bin/ld: error: ./vector_summation.o: multiple definition of 'perform_summation_method2(int*, int*, int)'
/usr/bin/ld: ./kernels.o: previous definition here
/usr/bin/ld: error: ./vector_summation.o: multiple definition of '__device_stub__Z25perform_summation_method3PiS_i(int*, int*, int)'
/usr/bin/ld: ./kernels.o: previous definition here
/usr/bin/ld: error: ./vector_summation.o: multiple definition of 'perform_summation_method3(int*, int*, int)'
/usr/bin/ld: ./kernels.o: previous definition here