| 1 |
package org.argeo.jjml.ggml.params; |
| 2 |
|
| 3 |
import java.util.function.IntSupplier; |
| 4 |
|
| 5 |
/** |
| 6 |
* GGML NUMA strategy enumeration. (see enum <code>ggml_numa_strategy</code>, in |
| 7 |
* ggml.h) |
| 8 |
*/ |
| 9 |
public enum NumaStrategy implements IntSupplier { |
| 10 |
GGML_NUMA_STRATEGY_DISABLED(0), // |
| 11 |
GGML_NUMA_STRATEGY_DISTRIBUTE(1), // |
| 12 |
GGML_NUMA_STRATEGY_ISOLATE(2), // |
| 13 |
GGML_NUMA_STRATEGY_NUMACTL(3), // |
| 14 |
GGML_NUMA_STRATEGY_MIRROR(4), // |
| 15 |
; |
| 16 |
|
| 17 |
private int code; |
| 18 |
|
| 19 |
private NumaStrategy(int code) { |
| 20 |
this.code = code; |
| 21 |
} |
| 22 |
|
| 23 |
@Override |
| 24 |
public int getAsInt() { |
| 25 |
return code; |
| 26 |
} |
| 27 |
|
| 28 |
public static NumaStrategy byCode(int code) throws IllegalArgumentException { |
| 29 |
for (NumaStrategy type : values()) |
| 30 |
if (type.code == code) |
| 31 |
return type; |
| 32 |
throw new IllegalArgumentException("Unkown code : " + code); |
| 33 |
} |
| 34 |
|
| 35 |
} |