Class: CNTK::DeviceDescriptor

Inherits:
Object
  • Object
show all
Defined in:
ext/cntk/cntk_wrap.cxx

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_devices(*args) ⇒ Object



18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
# File 'ext/cntk/cntk_wrap.cxx', line 18204

SWIGINTERN VALUE
_wrap_DeviceDescriptor_all_devices(int argc, VALUE *argv, VALUE self) {
  std::vector< CNTK::DeviceDescriptor,std::allocator< CNTK::DeviceDescriptor > > *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (std::vector< CNTK::DeviceDescriptor,std::allocator< CNTK::DeviceDescriptor > > *) &CNTK::DeviceDescriptor::AllDevices(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = swig::from(static_cast< std::vector< CNTK::DeviceDescriptor,std::allocator< CNTK::DeviceDescriptor > > >(*result));
  return vresult;
fail:
  return Qnil;
}

.cpudevice(*args) ⇒ Object



18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
# File 'ext/cntk/cntk_wrap.cxx', line 18040

SWIGINTERN VALUE
_wrap_DeviceDescriptor_cpudevice(int argc, VALUE *argv, VALUE self) {
  CNTK::DeviceDescriptor *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (CNTK::DeviceDescriptor *)CNTK_DeviceDescriptor_CPUDevice(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CNTK__DeviceDescriptor, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}

.gpudevice(*args) ⇒ Object



18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
# File 'ext/cntk/cntk_wrap.cxx', line 18072

SWIGINTERN VALUE
_wrap_DeviceDescriptor_gpudevice(int argc, VALUE *argv, VALUE self) {
  unsigned int arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  CNTK::DeviceDescriptor *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","CNTK_DeviceDescriptor_GPUDevice", 1, argv[0] ));
  } 
  arg1 = static_cast< unsigned int >(val1);
  {
    try {
      result = (CNTK::DeviceDescriptor *)CNTK_DeviceDescriptor_GPUDevice(arg1); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CNTK__DeviceDescriptor, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}

.use_default_device(*args) ⇒ Object



18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
# File 'ext/cntk/cntk_wrap.cxx', line 18112

SWIGINTERN VALUE
_wrap_DeviceDescriptor_use_default_device(int argc, VALUE *argv, VALUE self) {
  CNTK::DeviceDescriptor *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (CNTK::DeviceDescriptor *)CNTK_DeviceDescriptor_UseDefaultDevice(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CNTK__DeviceDescriptor, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}

Instance Method Details

#==(*args) ⇒ Object

call-seq:

==(other) -> bool

Equality comparison operator.



18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
# File 'ext/cntk/cntk_wrap.cxx', line 18153

SWIGINTERN VALUE
_wrap_DeviceDescriptor___eq__(int argc, VALUE *argv, VALUE self) {
  CNTK::DeviceDescriptor *arg1 = (CNTK::DeviceDescriptor *) 0 ;
  CNTK::DeviceDescriptor *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__DeviceDescriptor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::DeviceDescriptor *","__eq__", 1, self )); 
  }
  arg1 = reinterpret_cast< CNTK::DeviceDescriptor * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CNTK__DeviceDescriptor,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "CNTK::DeviceDescriptor const &","__eq__", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "CNTK::DeviceDescriptor const &","__eq__", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< CNTK::DeviceDescriptor * >(argp2);
  {
    try {
      result = (bool)CNTK_DeviceDescriptor___eq__(arg1,(CNTK::DeviceDescriptor const &)*arg2); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}

#id(*args) ⇒ Object



17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
# File 'ext/cntk/cntk_wrap.cxx', line 17960

SWIGINTERN VALUE
_wrap_DeviceDescriptor_id(int argc, VALUE *argv, VALUE self) {
  CNTK::DeviceDescriptor *arg1 = (CNTK::DeviceDescriptor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__DeviceDescriptor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::DeviceDescriptor *","Id", 1, self )); 
  }
  arg1 = reinterpret_cast< CNTK::DeviceDescriptor * >(argp1);
  {
    try {
      result = (unsigned int)(arg1)->Id(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}

#type(*args) ⇒ Object



18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
# File 'ext/cntk/cntk_wrap.cxx', line 18000

SWIGINTERN VALUE
_wrap_DeviceDescriptor_type(int argc, VALUE *argv, VALUE self) {
  CNTK::DeviceDescriptor *arg1 = (CNTK::DeviceDescriptor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  CNTK::DeviceKind result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CNTK__DeviceDescriptor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CNTK::DeviceDescriptor *","Type", 1, self )); 
  }
  arg1 = reinterpret_cast< CNTK::DeviceDescriptor * >(argp1);
  {
    try {
      result = (CNTK::DeviceKind)(arg1)->Type(); 
    }
    catch (const std::runtime_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (const std::invalid_argument &e) {
      SWIG_exception(SWIG_ValueError,e.what()); 
    }
    catch (const std::logic_error &e) {
      SWIG_exception(SWIG_RuntimeError,e.what()); 
    }
    catch (...) {
      SWIG_exception(SWIG_UnknownError,"Runtime exception"); 
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}