Commit 5351a1d4 authored by Kevin Di Lallo's avatar Kevin Di Lallo
Browse files

added gpu support in frontend

parent 02169c61
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ deployment:
    requests: {}
    limits:
    {{- if .Deployment.GpuEnabled}}
    {{- if eq .Deployment.GpuType "nvidia" }}
    {{- if eq .Deployment.GpuType "NVIDIA" }}
      nvidia.com/gpu: {{.Deployment.GpuCount}}
    {{- end}}
    {{- end}}
+2 −1
Original line number Diff line number Diff line
@@ -35,7 +35,8 @@ AdvantEDGE is composed of a collection of micro-services (a.k.a the groups).

Deploy command starts a group of containers the in the K8s cluster.
Optional registry & tag parameters allows to specify a shared registry & tag for core images.
Default registry/tag are: local registry & latest
Default registry is configured in ~/.meepctl.yaml.
Defaut tag is: latest

Valid groups:
  * core: AdvantEDGE core containers
+70 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import {
  FIELD_PORT,
  FIELD_PROTOCOL,
  FIELD_GROUP,
  FIELD_GPU_COUNT,
  FIELD_GPU_TYPE,
  FIELD_ENV_VAR,
  FIELD_CMD,
  FIELD_CMD_ARGS,
@@ -70,6 +72,9 @@ import {
  ELEMENT_TYPE_EDGE_APP,
  ELEMENT_TYPE_CLOUD_APP,

  // GPU types
  GPU_TYPE_NVIDIA,

  // NC Group Prefixes
  PREFIX_INT_DOM,
  PREFIX_INT_ZONE,
@@ -88,6 +93,8 @@ import {
  CFG_ELEM_PORT,
  CFG_ELEM_EXT_PORT,
  CFG_ELEM_PROT,
  CFG_ELEM_GPU_COUNT,
  CFG_ELEM_GPU_TYPE,
  CFG_ELEM_CMD,
  CFG_ELEM_ARGS,
  CFG_ELEM_CHART_CHECK,
@@ -107,6 +114,8 @@ const SERVICE_PORT_MIN = 1;
const SERVICE_PORT_MAX = 65535;
const SERVICE_NODE_PORT_MIN = 30000;
const SERVICE_NODE_PORT_MAX = 32767;
const GPU_COUNT_MIN = 1;
const GPU_COUNT_MAX = 4;

const validateName = (val) => {
  if (val) {
@@ -199,6 +208,21 @@ const validatePort = (port) => {
  return null;
};

const validateGpuCount = (count) => {
  if (count === '') {return null;}

  const notIntError =  validateInt(count);
  if (notIntError) {
    return notIntError;
  }

  const p = Number(count);
  if ((p !== '') && ((p < GPU_COUNT_MIN) || (p > GPU_COUNT_MAX))) {
    return GPU_COUNT_MIN + ' < count < ' + GPU_COUNT_MAX;
  }
  return null;
};

const validateExternalPort = (port) => {
  if (port === '') {return null;}

@@ -354,6 +378,40 @@ const PortProtocolGroup = ({onUpdate, element}) => {
  );
};

const gpuTypes = [
  GPU_TYPE_NVIDIA
];

const GpuGroup = ({onUpdate, element}) => {
  var type = getElemFieldVal(element, FIELD_GPU_TYPE) || '';

  return (
    <Grid>
      <CfgTextFieldCell
        span={4}
        onUpdate={onUpdate}
        element={element}
        validate={validateGpuCount}
        isNumber={true}
        label="GPU Count"
        fieldName={FIELD_GPU_COUNT}
        cydata={CFG_ELEM_GPU_COUNT}
      />
      <GridCell span={8} style={{paddingTop: 16}}>
        <IDSelect 
          label="GPU Type"
          span={8}
          options={gpuTypes}
          onChange={(elem) => onUpdate(FIELD_GPU_TYPE, elem.target.value, null)}
          value={type}
          disabled={false}
          cydata={CFG_ELEM_GPU_TYPE}
        />
      </GridCell>
    </Grid>
  );
};

const CommandGroup = ({onUpdate, element}) => {
  return (
    <Grid>
@@ -487,6 +545,10 @@ const TypeRelatedFormFields = ({onUpdate, element}) => {
                          fieldName={FIELD_IMAGE}
                          cydata={CFG_ELEM_IMG}
                        />
                        <GpuGroup
                          onUpdate={onUpdate}
                          element={element}
                        />
                        <CfgTextField
                          onUpdate={onUpdate}
                          element={element}
@@ -545,6 +607,10 @@ const TypeRelatedFormFields = ({onUpdate, element}) => {
                          onUpdate={onUpdate}
                          element={element}
                        />
                        <GpuGroup
                          onUpdate={onUpdate}
                          element={element}
                        />
                        <CfgTextField
                          onUpdate={onUpdate}
                          element={element}
@@ -591,6 +657,10 @@ const TypeRelatedFormFields = ({onUpdate, element}) => {
                          onUpdate={onUpdate}
                          element={element}
                        />
                        <GpuGroup
                          onUpdate={onUpdate}
                          element={element}
                        />
                        <CfgTextField
                          onUpdate={onUpdate}
                          element={element}
+12 −2
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ import {
  FIELD_NAME,
  FIELD_SVC_MAP,
  FIELD_EXT_PORT,

  FIELD_GPU_COUNT,
  FIELD_GPU_TYPE,
  getElemFieldVal
} from '../../util/elem-utils';

@@ -197,6 +198,16 @@ class CfgPageContainer extends Component {
      return false;
    }

    // If GPU requested, make sure type is set
    var gpuCount = getElemFieldVal(element, FIELD_GPU_COUNT);
    if (gpuCount) {
      var gpuType = getElemFieldVal(element, FIELD_GPU_TYPE);
      if (gpuType === null || gpuType === '') {
        this.props.cfgElemSetErrMsg('GPU type not selected');
        return false;
      }
    }

    // TODO -- verify node port not already used
    const extPorts = externalPorts(element);

@@ -214,7 +225,6 @@ class CfgPageContainer extends Component {
      }
    }
    

    return true;
  }

+5 −0
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ export const CFG_ELEM_ENV = 'cfg-elem-env';
export const CFG_ELEM_PORT = 'cfg-elem-port';
export const CFG_ELEM_EXT_PORT = 'cfg-elem-ext-port';
export const CFG_ELEM_PROT = 'cfg-elem-prot';
export const CFG_ELEM_GPU_COUNT = 'cfg-elem-gpu-count';
export const CFG_ELEM_GPU_TYPE = 'cfg-elem-gpu-type';
export const CFG_ELEM_CMD = 'cfg-elem-cmd';
export const CFG_ELEM_ARGS = 'cfg-elem-args';
export const CFG_ELEM_CHART_CHECK = 'cfg-elem-chart-check';
@@ -151,6 +153,9 @@ export const DEFAULT_THROUGHPUT_TERMINAL_LINK = 1000;
export const DEFAULT_PACKET_LOSS_TERMINAL_LINK = 1;
export const DEFAULT_LATENCY_DC = 0;

// GPU Types
export const GPU_TYPE_NVIDIA = 'NVIDIA';

// Monitoring Page IDs
export const MON_DASHBOARD_SELECT = 'mon-dashboard-select';
export const MON_DASHBOARD_IFRAME = 'mon-dashboard-iframe';
Loading