nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/util/AllocUtil.java
public static void setAllocationModeForContext(String allocationModeForContext) {
        if (!allocationModeForContext.equals("heap") && !allocationModeForContext.equals("javacpp")
                        && !allocationModeForContext.equals("direct"))
            throw new IllegalArgumentException("Allocation mode must be one of: heap,javacpp, or direct");
        Nd4jContext.getInstance().getConf().put("alloc", allocationModeForContext);
    }
public static void setAllocationModeForContext(String allocationModeForContext) {
        if (!allocationModeForContext.equals("heap") && !allocationModeForContext.equals("javacpp")
                        && !allocationModeForContext.equals("direct"))
            throw new IllegalArgumentException("Allocation mode must be one of: heap,javacpp, or direct");
        Nd4jContext.getInstance().getConf().put("alloc", allocationModeForContext);
    }
Set the allocation mode for the nd4j context
The value must be one of: heap, java cpp, or direct
or an @link{IllegalArgumentException} is thrown
@param allocationModeForContext