DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
DeviceKernelLauncherConstants.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16
17/*
18 * @author Ian C. Lin., Sambit Das
19 */
20#ifdef DFTFE_WITH_DEVICE
21# ifndef dftfeDeviceKernelLauncherConstants_h
22# define dftfeDeviceKernelLauncherConstants_h
23
24# ifdef DFTFE_WITH_DEVICE_NVIDIA
25namespace dftfe
26{
27 namespace utils
28 {
29 static const int DEVICE_WARP_SIZE = 32;
30 static const int DEVICE_MAX_BLOCK_SIZE = 1024;
31 static const int DEVICE_BLOCK_SIZE = 256;
32
33 } // namespace utils
34} // namespace dftfe
35
36# elif DFTFE_WITH_DEVICE_AMD
37
38namespace dftfe
39{
40 namespace utils
41 {
42 static const int DEVICE_WARP_SIZE = 64;
43 static const int DEVICE_MAX_BLOCK_SIZE = 1024;
44 static const int DEVICE_BLOCK_SIZE = 512;
45
46 } // namespace utils
47} // namespace dftfe
48
49# endif
50# ifdef DFTFE_WITH_DEVICE_NVIDIA
51# define DFTFE_LAUNCH_KERNEL(kernel, grid, block, shared, stream, ...) \
52 do \
53 { \
54 kernel<<<grid, block, shared, stream>>>(__VA_ARGS__); \
55 } while (0)
56# elif defined(DFTFE_WITH_DEVICE_AMD)
57# define DFTFE_LAUNCH_KERNEL(kernel, grid, block, shared, stream, ...) \
58 do \
59 { \
60 hipLaunchKernelGGL(HIP_KERNEL_NAME(kernel), \
61 grid, \
62 block, \
63 shared, \
64 stream, \
65 __VA_ARGS__); \
66 } while (0)
67# else
68# error \
69 "No device backend defined (DFTFE_WITH_DEVICE_NVIDIA or DFTFE_WITH_DEVICE_AMD)"
70# endif
71# define DFTFE_KERNEL_NAME(...) __VA_ARGS__
72# endif // dftfeDeviceKernelLauncherConstants_h
73#endif // DFTFE_WITH_DEVICE
Definition Cell.h:36
Definition pseudoPotentialToDftfeConverter.cc:34