File: BeagleFlag.java

package info (click to toggle)
libhmsbeagle 2.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,756 kB
  • ctags: 2,341
  • sloc: cpp: 17,296; ansic: 5,842; java: 1,696; sh: 1,325; python: 486; makefile: 335; xml: 299
file content (70 lines) | stat: -rw-r--r-- 2,144 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package beagle;

/**
 * @author Andrew Rambaut
 * @author Marc Suchard
 * @version $Id$
 */
public enum BeagleFlag {
    PRECISION_SINGLE(1 << 0, "double precision computation"),
    PRECISION_DOUBLE(1 << 1, "single precision computation"),

    COMPUTATION_SYNCH(1 << 2, "synchronous computation (blocking"),
    COMPUTATION_ASYNCH(1 << 3, "asynchronous computation (non-blocking)"),

    EIGEN_REAL(1 <<4, "real eigenvalue computation"),
    EIGEN_COMPLEX(1 <<5, "complex eigenvalue computation"),

    SCALING_MANUAL(1 << 6, "manual scaling"),
    SCALING_AUTO(1 << 7, "auto-scaling on"),
    SCALING_ALWAYS(1 << 8, "scale at every update"),
    SCALING_DYNAMIC(1 << 19, "manual scaling with dynamic checking"),            

    SCALERS_RAW(1 << 9, "save raw scalers"),
    SCALERS_LOG(1 << 10, "save log scalers"),

    VECTOR_SSE(1 << 11, "SSE vector computation"),
    VECTOR_NONE(1 << 12, "no vector computation"),

    THREADING_OPENMP(1 << 13, "OpenMP threading"),
    THREADING_NONE(1 << 14, "no threading"),

    PROCESSOR_CPU(1 << 15, "use CPU as main processor"),
    PROCESSOR_GPU(1 << 16, "use GPU as main processor"),
    PROCESSOR_FPGA(1 << 17, "use FPGA as main processor"),
    PROCESSOR_CELL(1 << 18, "use CELL as main processor"),

    FRAMEWORK_CUDA(1 << 22, "use CUDA implementation with GPU resources"),
    FRAMEWORK_OPENCL(1 << 23, "use OpenCL implementation with CPU or GPU resources"),
    FRAMEWORK_CPU(1 << 27, "use CPU implementation");

    BeagleFlag(long mask, String meaning) {
        this.mask = mask;
        this.meaning = meaning;
    }

    public long getMask() {
        return mask;
    }

    public String getMeaning() {
        return meaning;
    }

    public boolean isSet(long flags) {
        return (flags & mask) != 0;
    }

    public static String toString(long flags) {
        StringBuilder sb = new StringBuilder();
        for (BeagleFlag flag : BeagleFlag.values()) {
            if (flag.isSet(flags)) {
                sb.append(" ").append(flag.name());
            }
        }
        return sb.toString();
    }

    private final long mask;
    private final String meaning;
}