MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / main

Function main

python/1_GettingStarted/vectorAdd/vectorAdd.py:158–192  ·  view source on GitHub ↗

Main entry point for the vector addition sample.

()

Source from the content-addressed store, hash-verified

156
157
158def main():
159 """
160 Main entry point for the vector addition sample.
161 """
162 import argparse
163
164 parser = argparse.ArgumentParser(description="Vector Addition using CUDA Core API")
165 parser.add_argument(
166 "--elements",
167 type=int,
168 default=50000,
169 help="Number of elements in vectors (default: 50000)",
170 )
171 parser.add_argument(
172 "--device", type=int, default=0, help="CUDA device ID (default: 0)"
173 )
174 parser.add_argument(
175 "--no-verify", action="store_true", help="Skip result verification"
176 )
177
178 args = parser.parse_args()
179
180 if args.elements <= 0:
181 print("Error: Number of elements must be positive")
182 return 1
183
184 success = vector_add_cuda_core(
185 num_elements=args.elements, device_id=args.device, verify=not args.no_verify
186 )
187
188 if success:
189 print("\nDone")
190 return 0
191 else:
192 return 1
193
194
195if __name__ == "__main__":

Callers 1

vectorAdd.pyFile · 0.70

Calls 1

vector_add_cuda_coreFunction · 0.85

Tested by

no test coverage detected