00001 /************************************************************************* 00002 * Copyright (C) 2011 by Saleh Dindar and the Swarm-NG Development Team * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 3 of the License. * 00007 * * 00008 * This program is distributed in the hope that it will be useful, * 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00011 * GNU General Public License for more details. * 00012 * * 00013 * You should have received a copy of the GNU General Public License * 00014 * along with this program; if not, write to the * 00015 * Free Software Foundation, Inc., * 00016 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00017 ************************************************************************/ 00018 00026 #pragma once 00027 00028 #include "common.hpp" 00029 #include "types/ensemble.hpp" 00030 #include "types/config.hpp" 00031 #include "log/logmanager.hpp" 00032 #include "integrator.hpp" 00033 #include "plugin.hpp" 00034 #include "utils.hpp" 00035 #include "gpu/device_settings.hpp" 00036 #include "snapshot.hpp" 00037 00041 namespace swarm { 00042 00048 inline void init(const config &cfg) { 00050 const char* devstr = getenv("CUDA_DEVICE"); 00051 00053 const int env_dev = (devstr != NULL) ? atoi(devstr) : 0; 00054 00056 const int dev = cfg.optional("CUDA_DEVICE", env_dev); 00057 00059 select_cuda_device(dev); 00060 00061 if(cfg.optional("more_cache",0)!=0){ 00062 set_more_cache(); 00063 } 00065 if(cfg.optional("verbose",0)!=0){ 00066 print_device_information(); 00067 } 00068 00070 swarm::log::manager::default_log()->init(cfg); 00071 } 00072 00073 00074 }