neurali:nemo_esempio1_c
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
neurali:nemo_esempio1_c [2015/07/16 11:42] – profpro | neurali:nemo_esempio1_c [2020/06/08 22:20] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Questo ed altri esempi si trovano nelle cartelle dei sorgenti | ||
+ | nemo/ | ||
+ | |||
+ | nemo/ | ||
+ | |||
+ | |||
+ | <code c> | ||
+ | /* Copyright 2010 Imperial College London | ||
+ | * | ||
+ | * This file is part of NeMo. | ||
+ | * | ||
+ | * This software is licenced for non-commercial academic use under the GNU | ||
+ | * General Public Licence (GPL). You should have received a copy of this | ||
+ | * licence along with nemo. If not, see < | ||
+ | */ | ||
+ | |||
+ | /* This is a top-level utility app for NeMo, which currently only prints | ||
+ | * information about the library and the parts of the systems on which it can | ||
+ | * run. | ||
+ | */ | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | |||
+ | void | ||
+ | listCudaDevices() | ||
+ | { | ||
+ | #ifdef NEMO_CUDA_ENABLED | ||
+ | unsigned dcount | ||
+ | |||
+ | if(dcount == 0) { | ||
+ | std::cout << "No CUDA devices available\n"; | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | for(unsigned d = 0; d < dcount; ++d) { | ||
+ | std::cout << d << ": " << nemo:: | ||
+ | } | ||
+ | #else | ||
+ | std::cout << "No CUDA devices available\n"; | ||
+ | #endif | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | int | ||
+ | main(int argc, char* argv[]) | ||
+ | { | ||
+ | namespace po = boost:: | ||
+ | po:: | ||
+ | desc.add_options() | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | ; | ||
+ | |||
+ | po:: | ||
+ | try { | ||
+ | po:: | ||
+ | } catch(boost:: | ||
+ | std::cerr << " | ||
+ | exit(1); | ||
+ | } | ||
+ | po:: | ||
+ | |||
+ | if(vm.count(" | ||
+ | std::cout << " | ||
+ | std::cout << desc << std::endl; | ||
+ | exit(0); | ||
+ | } | ||
+ | |||
+ | if(vm.count(" | ||
+ | std::cout << nemo:: | ||
+ | //! \todo list exact build as well | ||
+ | //! \todo list build options as well | ||
+ | exit(0); | ||
+ | } | ||
+ | |||
+ | if(vm.count(" | ||
+ | listCudaDevices(); | ||
+ | exit(0); | ||
+ | } | ||
+ | |||
+ | if(vm.count(" | ||
+ | std::cout << NEMO_SYSTEM_PLUGIN_DIR << std::endl; | ||
+ | exit(0); | ||
+ | } | ||
+ | |||
+ | if(vm.count(" | ||
+ | std::cout << NEMO_USER_PLUGIN_DIR << std::endl; | ||
+ | exit(0); | ||
+ | } | ||
+ | |||
+ | /* No options chosen, so return error */ | ||
+ | |||
+ | std::cout << " | ||
+ | std::cout << desc << std::endl; | ||
+ | return 1; | ||
+ | } | ||
+ | </ |