Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一堆常用函数,如swap,min等max。如何标记它们以便我可以从主机和设备调用它们?
swap
min
max
您__host__ __device__在函数声明之前使用,例如:
__host__
__device__
__host__ __device__ int min(int A, int B) {return (A<B)?A:B;}
这在此处的 C 编程指南中有记录。