PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
nvGPUutil.h
Go to the documentation of this file.
1 /***************************************************************************\
2 |* *|
3 |* Copyright 2007 NVIDIA Corporation. All rights reserved. *|
4 |* *|
5 |* NOTICE TO USER: *|
6 |* *|
7 |* This source code is subject to NVIDIA ownership rights under U.S. *|
8 |* and international Copyright laws. Users and possessors of this *|
9 |* source code are hereby granted a nonexclusive, royalty-free *|
10 |* license to use this code in individual and commercial software. *|
11 |* *|
12 |* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE *|
13 |* CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR *|
14 |* IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH *|
15 |* REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF *|
16 |* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR *|
17 |* PURPOSE. IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, *|
18 |* INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES *|
19 |* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN *|
20 |* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *|
21 |* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE *|
22 |* CODE. *|
23 |* *|
24 |* U.S. Government End Users. This source code is a "commercial item" *|
25 |* as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting *|
26 |* of "commercial computer software" and "commercial computer software *|
27 |* documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) *|
28 |* and is provided to the U.S. Government only as a commercial end item. *|
29 |* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through *|
30 |* 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the *|
31 |* source code with only those rights set forth herein. *|
32 |* *|
33 |* Any use of this source code in individual and commercial software must *|
34 |* include, in the user documentation and internal comments to the code, *|
35 |* the above Disclaimer and U.S. Government End Users Notice. *|
36 |* *|
37 |* *|
38 \***************************************************************************/
39 
40 #ifndef NVGPUUTIL_H
41 #define NVGPUUTIL_H
42 
43 #if WIN32
44 #include <windows.h>
45 #endif
46 #include <assert.h>
47 #include <stdio.h>
48 
49 #include <string>
50 #include <iostream>
51 
52 #include "nvConfigure.h"
53 #include <GL/glu.h>
54 
55 #define MAX_GPUS 4
56 
57 //----------------------------------------------------------------------------
58 typedef class CNvGpu
59 {
60 public:
61  CNvGpu();
62  virtual ~CNvGpu();
63 
64  bool Init( HGPUNV gpuAffinityHandle, bool bPrimary, bool bDisplay );
65  bool isPrimary();
66  bool isDisplay();
67  HGPUNV getAffinityHandle();
68 
69 protected:
70  HGPUNV m_hGpu;
71  bool m_bPrimary; //contains the desktop
72  bool m_bDisplay;
73 } CNvGPU;
74 
75 //----------------------------------------------------------------------------
76 typedef class CNvGpuTopology
77 {
78 public:
79  static CNvGpuTopology& Instance();
80  virtual CNvGpu* GetGpu( int index );
81  virtual CNvGpu* GetPrimaryGpu();
82  int GetNumGpu();
83  int GetPrimaryGpuIndex();
84 
85 protected:
87  virtual ~CNvGpuTopology();
88  bool Init();
89 
90 protected:
92  int m_nGpu;
95 
96 #if WIN32
97 bool CreateDummyGLWindowWin32( HWND* hWnd, HGLRC* hGLRC );
98 bool DestroyGLWindowWin32( HWND* hWnd, HGLRC* hGLRC );
99 #endif
100 
101 #endif
#define MAX_GPUS
Definition: nvGPUutil.h:55
virtual CNvGpu * GetGpu(int index)
Definition: nvGPUutil.cpp:271
virtual CNvGpu * GetPrimaryGpu()
Definition: nvGPUutil.cpp:294
virtual ~CNvGpu()
Definition: nvGPUutil.cpp:313
bool isDisplay()
Definition: nvGPUutil.cpp:334
CNvGpu * m_lGpu[MAX_GPUS]
Definition: nvGPUutil.h:91
bool m_bInitialized
Definition: nvGPUutil.h:93
class CNvGpu CNvGPU
HGPUNV getAffinityHandle()
Definition: nvGPUutil.cpp:340
class CNvGpuTopology CNvGpuTopology
bool Init(HGPUNV gpuAffinityHandle, bool bPrimary, bool bDisplay)
Definition: nvGPUutil.cpp:319
bool isPrimary()
Definition: nvGPUutil.cpp:328
bool m_bDisplay
Definition: nvGPUutil.h:72
virtual ~CNvGpuTopology()
Definition: nvGPUutil.cpp:148
bool m_bPrimary
Definition: nvGPUutil.h:71
HGPUNV m_hGpu
Definition: nvGPUutil.h:70
int GetPrimaryGpuIndex()
Definition: nvGPUutil.cpp:281
static CNvGpuTopology & Instance()
Definition: nvGPUutil.cpp:258