आप शामिल करने के लिए stdio.h
नहीं iostream
printf
के लिए (man 3 printf
देखें) (जो std::cout
सामान के लिए है) की जरूरत है। मुझे here पुस्तक के लिए स्रोत कोड मिला।
chapter03/hello_world.cu
वास्तव में है:
/*
* Copyright 1993-2010 NVIDIA Corporation. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and
* proprietary rights in and to this software and related documentation.
* Any use, reproduction, disclosure, or distribution of this software
* and related documentation without an express license agreement from
* NVIDIA Corporation is strictly prohibited.
*
* Please refer to the applicable NVIDIA end user license agreement (EULA)
* associated with this source code for terms and conditions that govern
* your use of this NVIDIA software.
*
*/
#include "../common/book.h"
int main(void) {
printf("Hello, World!\n");
return 0;
}
कहाँ ../common/book.h
stdio.h
भी शामिल है।
README.txt
फ़ाइल विवरण
कैसे उदाहरण संकलित करने के लिए:
The vast majority of these code examples can be compiled quite easily by using
NVIDIA's CUDA compiler driver, nvcc. To compile a typical example, say
"example.cu," you will simply need to execute:
> nvcc example.cu
@awoodland है: Hmmmm, दूसरा जवाब यह होता है, और वास्तव में खंड B14 "printf (" हैलो धागा% d, च =% च है कहते हैं \ n ", threadIdx.x, f);" – Kheldar
तब इसे कैसे संकलित किया जाना चाहिए? – andandandand
उस पुस्तक से कोड सामान केवल स्निपेट हैं यदि मुझे सही याद है, और हमेशा पूर्ण उदाहरण नहीं हैं। उल्लेख नहीं है कि वे उन उदाहरणों में बुरे अभ्यास के अल्टो का उपयोग करते हैं .... –