DeviceCUDA.C File Reference

#include "common.h"
#include "charm++.h"
#include "DeviceCUDA.h"
#include "WorkDistrib.h"
#include "CudaUtils.h"
#include <cuda_runtime.h>
#include <cuda.h>

Go to the source code of this file.

Classes

struct  cuda_args_t

Defines

#define MAX_NUM_RANKS   2048
#define MAX_NUM_DEVICES   256
#define REGISTER_DEVICE_EVENTS(DEV)

Functions

void cuda_initialize ()
void cuda_finalize ()
void cuda_getargs (char **argv)

Variables

__thread DeviceCUDAdeviceCUDA
static __thread cuda_args_t cuda_args
int deviceIDList [MAX_NUM_RANKS]
int masterPeList [MAX_NUM_DEVICES]


Define Documentation

#define MAX_NUM_DEVICES   256

Definition at line 70 of file DeviceCUDA.C.

Referenced by DeviceCUDA::initialize().

#define MAX_NUM_RANKS   2048

Definition at line 67 of file DeviceCUDA.C.

Referenced by DeviceCUDA::initialize().

#define REGISTER_DEVICE_EVENTS ( DEV   ) 

Value:

traceRegisterUserEvent("CUDA device " #DEV " remote", CUDA_EVENT_ID_BASE + 2 * DEV); \
  traceRegisterUserEvent("CUDA device " #DEV " local", CUDA_EVENT_ID_BASE + 2 * DEV + 1);


Function Documentation

void cuda_finalize (  ) 

Definition at line 26 of file DeviceCUDA.C.

Referenced by BackEnd::exit().

00026                      {
00027     int ndevs = 0;
00028     cudaGetDeviceCount(&ndevs);
00029     for ( int dev=0; dev < ndevs; ++dev ) {
00030         cudaSetDevice(dev);
00031         cudaDeviceReset();
00032     }
00033 }

void cuda_getargs ( char **  argv  ) 

Definition at line 51 of file DeviceCUDA.C.

References cuda_args, cuda_args_t::devicelist, cuda_args_t::devicesperreplica, cuda_args_t::ignoresharing, cuda_args_t::mergegrids, NAMD_die(), cuda_args_t::nomergegrids, cuda_args_t::nostreaming, and cuda_args_t::usedevicelist.

Referenced by all_init().

00051                                {
00052   cuda_args.devicelist = 0;
00053   cuda_args.usedevicelist = CmiGetArgStringDesc(argv, "+devices", &cuda_args.devicelist,
00054                 "comma-delimited list of CUDA device numbers such as 0,2,1,2");
00055   cuda_args.devicesperreplica = 0;
00056   CmiGetArgInt(argv, "+devicesperreplica", &cuda_args.devicesperreplica);
00057   if ( cuda_args.devicesperreplica < 0 ) NAMD_die("Devices per replica must be positive\n");
00058   cuda_args.ignoresharing = CmiGetArgFlag(argv, "+ignoresharing");
00059   cuda_args.mergegrids = CmiGetArgFlag(argv, "+mergegrids");
00060   cuda_args.nomergegrids = CmiGetArgFlag(argv, "+nomergegrids");
00061   if ( cuda_args.mergegrids && cuda_args.nomergegrids ) NAMD_die("Do not specify both +mergegrids and +nomergegrids");
00062   cuda_args.nostreaming = CmiGetArgFlag(argv, "+nostreaming");
00063 }

void cuda_initialize (  ) 

Definition at line 20 of file DeviceCUDA.C.

References deviceCUDA, and DeviceCUDA::initialize().

Referenced by WorkDistrib::peOrderingReady().

00020                        {
00021         deviceCUDA = new DeviceCUDA();
00022         deviceCUDA->initialize();
00023 }


Variable Documentation

__thread cuda_args_t cuda_args [static]

Definition at line 49 of file DeviceCUDA.C.

Referenced by cuda_getargs(), and DeviceCUDA::initialize().

__thread DeviceCUDA* deviceCUDA

Definition at line 18 of file DeviceCUDA.C.

int deviceIDList[MAX_NUM_RANKS]

Definition at line 68 of file DeviceCUDA.C.

Referenced by DeviceCUDA::getDeviceIDforPe(), and DeviceCUDA::initialize().

int masterPeList[MAX_NUM_DEVICES]

Definition at line 71 of file DeviceCUDA.C.

Referenced by DeviceCUDA::getMasterPeForDeviceID(), and DeviceCUDA::initialize().


Generated on Tue Sep 19 01:17:15 2017 for NAMD by  doxygen 1.4.7