Ich versuche Schub verwenden :: copy_if ein Array mit einem Prädikat zu verdichten für positive Zahlen Überprüfung:Schub copy_if: unvollständiger Typ nicht erlaubt ist
Header-Datei: file.h:
struct is_positive
{
__host__ __device__
bool operator()(const int x)
{
return (x >= 0);
}
};
und file.cu
#include "../headers/file.h"
#include <thrust/device_ptr.h>
#include <thrust/device_vector.h>
#include <thrust/copy.h>
void compact(int* d_inputArray, int* d_outputArray, const int size)
{
thrust::device_ptr<int> t_inputArray(d_inputArray);
thrust::device_ptr<int> t_outputArray(d_outputArray);
thrust::copy_if(t_inputArray, t_inputArray + size, d_outputArray, is_positive());
}
ich erhalte Fehlermeldungen, beginnend mit:
/usr/local/cuda/include/thrust/system/detail/generic/memory.inl(40): error: incomplete type is not allowed
Wenn ich Kopie statt copy_if kompiliert der Code in Ordnung, so entschied ich alles außer dem Prädikat is_positive() out verwenden nur.
Vielen Dank im Voraus für jede Hilfe oder allgemeine Tipps zum Debuggen solcher Schubfehler.
e: Ich bin mit Cuda 7.5
Nun, das ist peinlich. Danke, du hast recht, funktioniert wie ein Zauber! – mimre