示例#1
0
func writeInfoJSON(wr io.Writer) {
	var err error

	r := struct {
		Version struct{ Driver, CUDA string }
		Devices []nvidia.Device
	}{
		Devices: Devices,
	}
	r.Version.Driver, err = nvidia.GetDriverVersion()
	assert(err)
	r.Version.CUDA, err = nvidia.GetCUDAVersion()
	assert(err)

	assert(json.NewEncoder(wr).Encode(r))
}
示例#2
0
func GenerateLocalArgs(image string, vols []string) ([]string, error) {
	cv, err := nvidia.GetCUDAVersion()
	if err != nil {
		return nil, err
	}
	if err := cudaSupported(image, cv); err != nil {
		return nil, err
	}

	d, err := devicesArgs()
	if err != nil {
		return nil, err
	}
	v, err := volumesArgs(vols)
	if err != nil {
		return nil, err
	}
	return append(d, v...), nil
}