Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-05 09:34:14

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 // Built with NDEBUG defined: the device-side assert below only fires if
0010 // ACTS_FORCE_ASSERTIONS re-enabled it.
0011 
0012 #include <cassert>
0013 #include <cstdio>
0014 
0015 #include <cuda_runtime.h>
0016 
0017 __global__ void assertKernel() {
0018   assert(false && "forced assertion");
0019 }
0020 
0021 int main() {
0022   int nDevices = 0;
0023   if (cudaGetDeviceCount(&nDevices) != cudaSuccess || nDevices == 0) {
0024     // Reported as skipped by CTest
0025     return 77;
0026   }
0027   assertKernel<<<1, 1>>>();
0028   if (cudaDeviceSynchronize() == cudaErrorAssert) {
0029     // The device runtime has printed the assertion message by now
0030     return 1;
0031   }
0032   std::puts("ACTS_ASSERTION_NOT_TRIGGERED");
0033   return 0;
0034 }