Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
AlephCuda.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* AlephCuda.cc (C) 2010-2012 */
9/* */
10/*---------------------------------------------------------------------------*/
11/*---------------------------------------------------------------------------*/
12
13#include "arcane/aleph/AlephArcane.h"
14#include "arcane/aleph/cuda/IAlephCuda.h"
15
16/*---------------------------------------------------------------------------*/
17/*---------------------------------------------------------------------------*/
18
19ARCANE_BEGIN_NAMESPACE
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
25: public AbstractService
26, public IAlephFactoryImpl
27{
28 public:
30 public:
31 virtual void initialize()
32 {
33 debug()<<"\t[AlephFactory::AlephFactory] cudaDeviceReset";
35 debug()<<"\t[AlephFactory::AlephFactory] cudaDeviceSynchronize";
37 // Si le cublasInit ne pass pas, c'est que l'on a pas de device
39 return;
40 // throw FatalErrorException("AlephFactory", "Could not initialize CUBLAS!");
41 // Now check if there is a device supporting CUDA
42 int deviceCount;
44 if (deviceCount == 0)
45 throw FatalErrorException("AlephFactory", "No device found!");
46 int dev;
47 for (dev = 0; dev < deviceCount; ++dev) {
50 if (strncmp(deviceProp.name, "Device Emulation", 16))
51 break;
52 }
53 if (dev == deviceCount)
54 throw FatalErrorException(A_FUNCINFO, "No suitable device found");
55 debug()<<"\t[Aleph::Cuda::device_check] setting device!";
57 }
58
59 virtual IAlephTopology* createTopology(ITraceMng* tm,AlephKernel* kernel, Integer index, Integer nb_row_size)
60 {
61 return 0;
62 }
63
64 virtual IAlephVector* createVector(ITraceMng* tm,AlephKernel* kernel, Integer index)
65 {
66 return new AlephVectorCnc(tm,kernel,index);
67 }
68
69 virtual IAlephMatrix* createMatrix(ITraceMng* tm,AlephKernel* kernel, Integer index)
70 {
71 return new AlephMatrixCnc(tm,kernel,index);
72 }
73};
74
75/*---------------------------------------------------------------------------*/
76/*---------------------------------------------------------------------------*/
77
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
83ARCANE_END_NAMESPACE
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
#define ARCANE_REGISTER_APPLICATION_FACTORY(aclass, ainterface, aname)
Enregistre un service de fabrique pour la classe aclass.
Classe de base d'un service.
Interface d'une fabrique d'implémentation pour Aleph.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Structure contenant les informations pour créer un service.
Exception lorsqu'une erreur fatale est survenue.
Interface du gestionnaire de traces.