Debian Codegraph @

src/dr/evomodel/treedatalikelihood/continuous/cdi/CDIFlag.java

raw symbols SCIP
1 /*
2 * CDIFlags.java
3 *
4 * Copyright (c) 2002-2016 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
24 */
25
26 package dr.evomodel.treedatalikelihood.continuous.cdi;
27
28 /**
29 * @author Marc A. Suchard
30 */
31
32 public enum CDIFlag {
33 PRECISION_SINGLE(1L, "double precision computation"),
34 PRECISION_DOUBLE(2L, "single precision computation"),
35 COMPUTATION_SYNCH(4L, "synchronous computation (blocking"),
36 COMPUTATION_ASYNCH(8L, "asynchronous computation (non-blocking)"),
37 // EIGEN_REAL(16L, "real eigenvalue computation"),
38 // EIGEN_COMPLEX(32L, "complex eigenvalue computation"),
39 // SCALING_MANUAL(64L, "manual scaling"),
40 // SCALING_AUTO(128L, "auto-scaling on"),
41 // SCALING_ALWAYS(256L, "scale at every update"),
42 // SCALING_DYNAMIC(524288L, "manual scaling with dynamic checking"),
43 // SCALERS_RAW(512L, "save raw scalers"),
44 // SCALERS_LOG(1024L, "save log scalers"),
45 VECTOR_SSE(2048L, "SSE vector computation"),
46 VECTOR_NONE(4096L, "no vector computation"),
47 THREADING_TBB(8192L, "TBB threading"),
48 THREADING_NONE(16384L, "no threading"),
49 PROCESSOR_CPU(32768L, "use CPU as main processor"),
50 PROCESSOR_GPU(65536L, "use GPU as main processor"),
51 PROCESSOR_FPGA(131072L, "use FPGA as main processor"),
52 PROCESSOR_CELL(262144L, "use CELL as main processor"),
53 FRAMEWORK_CUDA(4194304L, "use CUDA implementation with GPU resources"),
54 FRAMEWORK_OPENCL(8388608L, "use OpenCL implementation with CPU or GPU resources"),
55 FRAMEWORK_CPU(134217728L, "use CPU implementation");
56
57 private final long mask;
58 private final String meaning;
59
60 CDIFlag(long mask, String meaning) {
61 this.mask = mask;
62 this.meaning = meaning;
63 }
64
65 public long getMask() {
66 return this.mask;
67 }
68
69 public String getMeaning() {
70 return this.meaning;
71 }
72
73 public boolean isSet(long bits) {
74 return (bits & this.mask) != 0L;
75 }
76
77 public static String toString(long bits) {
78 StringBuilder sb = new StringBuilder();
79 CDIFlag[] flags = values();
80
81 for (CDIFlag flag : flags) {
82 if (flag.isSet(bits)) {
83 sb.append(" ").append(flag.name());
84 }
85 }
86
87 return sb.toString();
88 }
89 }