mxnet

package module
v0.3.1-0...-1c2b684 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2020 License: NCSA Imports: 26 Imported by: 0

README

MLModelScope MXNet Agent

Build Status Build Status Go Report Card License

This is the MXNet agent for MLModelScope, an open-source framework and hardware agnostic, extensible and customizable platform for evaluating and profiling ML models across datasets / frameworks / systems, and within AI application pipelines.

Currently it has most of the models from Gluon Model Zoo built in. More built-in models are comming. One can evaluate the ~80 models on any systems of insterest with either local MXNet installation or MXNet docker images.

Check out MLModelScope and welcome to contribute.

Installation

Install go if you have not done so. Please follow Go Installation.

Download and install the MLModelScope MXNet Agent:

go get -v github.com/rai-project/mxnet

The agent requires The MXNet C library and other Go packages.

Go packages

You can install the dependency through go get.

cd $GOPATH/src/github.com/rai-project/mxnet
go get -u -v ./...

Or use Dep.

dep ensure -v

This installs the dependency in vendor/.

Note: The CGO interface passes go pointers to the C API. This is an error by the CGO runtime. Disable the error by placing

export GODEBUG=cgocheck=0

in your ~/.bashrc or ~/.zshrc file and then run either source ~/.bashrc or source ~/.zshrc

The MXNet C library

The MXNet C library is required.

If you use MXNet Docker Images (e.g. NVIDIA GPU CLOUD (NGC)), skip this step.

Refer to go-mxnet for mxnet installation.

External services

Refer to External services.

Use within MXNet Docker Images

Refer to Use within TensorFlow Docker Images.

Continue if you have

  • installed all the dependencies
  • downloaded carml_config_example.yml to $HOME as .carml_config.yml
  • launched docker external services on the host machine of the docker container you are going to use

, otherwise read above

An example of using NGC MXNet docker image:

nvidia-docker run --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 -it --privileged=true --network host \
-v $GOPATH:/workspace/go1.12/global \
-v $GOROOT:/workspace/go1.12_root \
-v ~/.carml_config.yml:/root/.carml_config.yml \
nvcr.io/nvidia/mxnet:19.06-py3

NOTE: The SHMEM allocation limit is set to the default of 64MB. This may be insufficient for MXNet. NVIDIA recommends the use of the following flags: nvidia-docker run --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 ...

Within the container, set up the environment so that the agent can find the MXNet installation.

export GOPATH=/workspace/go1.12/global
export GOROOT=/workspace/go1.12_root
export PATH=$GOROOT/bin:$PATH

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64/
export CGO_LDFLAGS="${CGO_LDFLAGS} -L /usr/local/cuda/lib64 -L /usr/local/cuda/extras/CUPTI/lib64/"

export PATH=$PATH:$(go env GOPATH)/bin  
export GODEBUG=cgocheck=0  
cd $GOPATH/src/github.com/rai-project/mxnet/mxnet-agent  

Usage

Refer to Usage

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthMxnet = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMxnet   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	Version   = "0.3.0"
	BuildDate = "undefined"
	GitCommit = "undefined"
)
View Source
var FrameworkManifest = dlframework.FrameworkManifest{
	Name:    "MXNet",
	Version: "1.4.0",
	Container: map[string]*dlframework.ContainerHardware{
		"amd64": {
			Cpu: "raiproject/carml-mxnet:amd64-cpu",
			Gpu: "raiproject/carml-mxnet:amd64-gpu",
		},
		"ppc64le": {
			Cpu: "raiproject/carml-mxnet:ppc64le-gpu",
			Gpu: "raiproject/carml-mxnet:ppc64le-gpu",
		},
	},
}

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func Register

func Register()

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Graph

type Graph struct {
	Nodes      []*Graph_Node      `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty" yaml:"nodes,omitempty"`
	ArgNodes   []int64            `protobuf:"varint,2,rep,packed,name=arg_nodes,json=argNodes,proto3" json:"arg_nodes,omitempty" yaml:"arg_nodes,omitempty"`
	NodeRowPtr []int64            `` /* 131-byte string literal not displayed */
	Heads      []*Graph_NodeEntry `protobuf:"bytes,4,rep,name=heads,proto3" json:"heads,omitempty" yaml:"heads,omitempty"`
	Attrs      *Graph_Attributes  `protobuf:"bytes,5,opt,name=attrs,proto3" json:"attrs,omitempty" yaml:"attrs,omitempty"`
}

func NewPopulatedGraph

func NewPopulatedGraph(r randyMxnet, easy bool) *Graph

func (*Graph) Descriptor

func (*Graph) Descriptor() ([]byte, []int)

func (*Graph) Equal

func (this *Graph) Equal(that interface{}) bool

func (*Graph) GetArgNodes

func (m *Graph) GetArgNodes() []int64

func (*Graph) GetAttrs

func (m *Graph) GetAttrs() *Graph_Attributes

func (*Graph) GetHeads

func (m *Graph) GetHeads() []*Graph_NodeEntry

func (*Graph) GetNodeRowPtr

func (m *Graph) GetNodeRowPtr() []int64

func (*Graph) GetNodes

func (m *Graph) GetNodes() []*Graph_Node

func (*Graph) GoString

func (this *Graph) GoString() string

func (*Graph) Marshal

func (m *Graph) Marshal() (dAtA []byte, err error)

func (*Graph) MarshalTo

func (m *Graph) MarshalTo(dAtA []byte) (int, error)

func (*Graph) ProtoMessage

func (*Graph) ProtoMessage()

func (*Graph) Reset

func (m *Graph) Reset()

func (*Graph) Size

func (m *Graph) Size() (n int)

func (*Graph) String

func (this *Graph) String() string

func (*Graph) ToDotGraph

func (g *Graph) ToDotGraph() (*gographviz.Escape, error)

func (*Graph) Unmarshal

func (m *Graph) Unmarshal(dAtA []byte) error

func (*Graph) VerboseEqual

func (this *Graph) VerboseEqual(that interface{}) error

func (*Graph) XXX_DiscardUnknown

func (m *Graph) XXX_DiscardUnknown()

func (*Graph) XXX_Marshal

func (m *Graph) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Graph) XXX_Merge

func (m *Graph) XXX_Merge(src proto.Message)

func (*Graph) XXX_Size

func (m *Graph) XXX_Size() int

func (*Graph) XXX_Unmarshal

func (m *Graph) XXX_Unmarshal(b []byte) error

type Graph_Attributes

type Graph_Attributes struct {
	Attrs map[string]string `` /* 174-byte string literal not displayed */
}

func NewPopulatedGraph_Attributes

func NewPopulatedGraph_Attributes(r randyMxnet, easy bool) *Graph_Attributes

func (*Graph_Attributes) Descriptor

func (*Graph_Attributes) Descriptor() ([]byte, []int)

func (*Graph_Attributes) Equal

func (this *Graph_Attributes) Equal(that interface{}) bool

func (*Graph_Attributes) GetAttrs

func (m *Graph_Attributes) GetAttrs() map[string]string

func (*Graph_Attributes) GoString

func (this *Graph_Attributes) GoString() string

func (*Graph_Attributes) Marshal

func (m *Graph_Attributes) Marshal() (dAtA []byte, err error)

func (*Graph_Attributes) MarshalTo

func (m *Graph_Attributes) MarshalTo(dAtA []byte) (int, error)

func (*Graph_Attributes) ProtoMessage

func (*Graph_Attributes) ProtoMessage()

func (*Graph_Attributes) Reset

func (m *Graph_Attributes) Reset()

func (*Graph_Attributes) Size

func (m *Graph_Attributes) Size() (n int)

func (*Graph_Attributes) String

func (this *Graph_Attributes) String() string

func (*Graph_Attributes) Unmarshal

func (m *Graph_Attributes) Unmarshal(dAtA []byte) error

func (*Graph_Attributes) VerboseEqual

func (this *Graph_Attributes) VerboseEqual(that interface{}) error

func (*Graph_Attributes) XXX_DiscardUnknown

func (m *Graph_Attributes) XXX_DiscardUnknown()

func (*Graph_Attributes) XXX_Marshal

func (m *Graph_Attributes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Graph_Attributes) XXX_Merge

func (m *Graph_Attributes) XXX_Merge(src proto.Message)

func (*Graph_Attributes) XXX_Size

func (m *Graph_Attributes) XXX_Size() int

func (*Graph_Attributes) XXX_Unmarshal

func (m *Graph_Attributes) XXX_Unmarshal(b []byte) error

type Graph_Node

type Graph_Node struct {
	Op               string             `protobuf:"bytes,1,opt,name=op,proto3" json:"op,omitempty" yaml:"op,omitempty"`
	Param            map[string]string  `` /* 175-byte string literal not displayed */
	Name             string             `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty" yaml:"name,omitempty"`
	Inputs           []*Graph_NodeEntry `protobuf:"bytes,4,rep,name=inputs,proto3" json:"inputs,omitempty" yaml:"inputs,omitempty"`
	BackwardSourceId int64              `` /* 148-byte string literal not displayed */
	ControlDeps      []int64            `` /* 132-byte string literal not displayed */
}

func NewPopulatedGraph_Node

func NewPopulatedGraph_Node(r randyMxnet, easy bool) *Graph_Node

func (*Graph_Node) Descriptor

func (*Graph_Node) Descriptor() ([]byte, []int)

func (*Graph_Node) Equal

func (this *Graph_Node) Equal(that interface{}) bool

func (*Graph_Node) GetBackwardSourceId

func (m *Graph_Node) GetBackwardSourceId() int64

func (*Graph_Node) GetControlDeps

func (m *Graph_Node) GetControlDeps() []int64

func (*Graph_Node) GetInputs

func (m *Graph_Node) GetInputs() []*Graph_NodeEntry

func (*Graph_Node) GetName

func (m *Graph_Node) GetName() string

func (*Graph_Node) GetOp

func (m *Graph_Node) GetOp() string

func (*Graph_Node) GetParam

func (m *Graph_Node) GetParam() map[string]string

func (*Graph_Node) GoString

func (this *Graph_Node) GoString() string

func (*Graph_Node) Marshal

func (m *Graph_Node) Marshal() (dAtA []byte, err error)

func (*Graph_Node) MarshalTo

func (m *Graph_Node) MarshalTo(dAtA []byte) (int, error)

func (*Graph_Node) ProtoMessage

func (*Graph_Node) ProtoMessage()

func (*Graph_Node) Reset

func (m *Graph_Node) Reset()

func (*Graph_Node) Size

func (m *Graph_Node) Size() (n int)

func (*Graph_Node) String

func (this *Graph_Node) String() string

func (*Graph_Node) Unmarshal

func (m *Graph_Node) Unmarshal(dAtA []byte) error

func (*Graph_Node) VerboseEqual

func (this *Graph_Node) VerboseEqual(that interface{}) error

func (*Graph_Node) XXX_DiscardUnknown

func (m *Graph_Node) XXX_DiscardUnknown()

func (*Graph_Node) XXX_Marshal

func (m *Graph_Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Graph_Node) XXX_Merge

func (m *Graph_Node) XXX_Merge(src proto.Message)

func (*Graph_Node) XXX_Size

func (m *Graph_Node) XXX_Size() int

func (*Graph_Node) XXX_Unmarshal

func (m *Graph_Node) XXX_Unmarshal(b []byte) error

type Graph_NodeEntry

type Graph_NodeEntry struct {
	NodeId  int64 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty" yaml:"node_id,omitempty"`
	Index   int64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty" yaml:"input,omitempty"`
	Version int64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty" yaml:"version,omitempty"`
}

func NewPopulatedGraph_NodeEntry

func NewPopulatedGraph_NodeEntry(r randyMxnet, easy bool) *Graph_NodeEntry

func (*Graph_NodeEntry) Descriptor

func (*Graph_NodeEntry) Descriptor() ([]byte, []int)

func (*Graph_NodeEntry) Equal

func (this *Graph_NodeEntry) Equal(that interface{}) bool

func (*Graph_NodeEntry) GetIndex

func (m *Graph_NodeEntry) GetIndex() int64

func (*Graph_NodeEntry) GetNodeId

func (m *Graph_NodeEntry) GetNodeId() int64

func (*Graph_NodeEntry) GetVersion

func (m *Graph_NodeEntry) GetVersion() int64

func (*Graph_NodeEntry) GoString

func (this *Graph_NodeEntry) GoString() string

func (*Graph_NodeEntry) Marshal

func (m *Graph_NodeEntry) Marshal() (dAtA []byte, err error)

func (*Graph_NodeEntry) MarshalJSON

func (e *Graph_NodeEntry) MarshalJSON() ([]byte, error)

func (*Graph_NodeEntry) MarshalTo

func (m *Graph_NodeEntry) MarshalTo(dAtA []byte) (int, error)

func (*Graph_NodeEntry) ProtoMessage

func (*Graph_NodeEntry) ProtoMessage()

func (*Graph_NodeEntry) Reset

func (m *Graph_NodeEntry) Reset()

func (*Graph_NodeEntry) Size

func (m *Graph_NodeEntry) Size() (n int)

func (*Graph_NodeEntry) String

func (this *Graph_NodeEntry) String() string

func (*Graph_NodeEntry) Unmarshal

func (m *Graph_NodeEntry) Unmarshal(dAtA []byte) error

func (*Graph_NodeEntry) UnmarshalJSON

func (e *Graph_NodeEntry) UnmarshalJSON(b []byte) error

func (*Graph_NodeEntry) VerboseEqual

func (this *Graph_NodeEntry) VerboseEqual(that interface{}) error

func (*Graph_NodeEntry) XXX_DiscardUnknown

func (m *Graph_NodeEntry) XXX_DiscardUnknown()

func (*Graph_NodeEntry) XXX_Marshal

func (m *Graph_NodeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Graph_NodeEntry) XXX_Merge

func (m *Graph_NodeEntry) XXX_Merge(src proto.Message)

func (*Graph_NodeEntry) XXX_Size

func (m *Graph_NodeEntry) XXX_Size() int

func (*Graph_NodeEntry) XXX_Unmarshal

func (m *Graph_NodeEntry) XXX_Unmarshal(b []byte) error

type ModelGraphAttributes

type ModelGraphAttributes map[string][]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL