void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) { if (!strcmp(dev, dro1->getDeviceName())) dro1->ISNewNumber(dev, name, values, names, n); else if (!strcmp(dev, dro2->getDeviceName())) dro2->ISNewNumber(dev, name, values, names, n); }
void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (!strcmp(dev, dro1->getDeviceName())) dro1->ISNewText(dev, name, texts, names, n); else if (!strcmp(dev, dro2->getDeviceName())) dro2->ISNewText(dev, name, texts, names, n); }
void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { if (!strcmp(dev, dro1->getDeviceName())) dro1->ISNewSwitch(dev, name, states, names, n); else if (!strcmp(dev, dro2->getDeviceName())) dro2->ISNewSwitch(dev, name, states, names, n); }
void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) { // Only call the corrected Focuser to execute evaluate the newNumber if (!strcmp(dev, lynxDriveF1->getDeviceName())) lynxDriveF1->ISNewNumber(dev, name, values, names, n); else if (!strcmp(dev, lynxDriveF2->getDeviceName())) lynxDriveF2->ISNewNumber(dev, name, values, names, n); }
void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { // Only call the corrected Focuser to execute evaluate the newText if (!strcmp(dev, lynxDriveF1->getDeviceName())) lynxDriveF1->ISNewText(dev, name, texts, names, n); else if (!strcmp(dev, lynxDriveF2->getDeviceName())) lynxDriveF2->ISNewText(dev, name, texts, names, n); }
void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { // Only call the corrected Focuser to execute evaluate the newSwitch if (!strcmp(dev, lynxDriveF1->getDeviceName())) lynxDriveF1->ISNewSwitch(dev, name, states, names, n); else if (!strcmp(dev, lynxDriveF2->getDeviceName())) lynxDriveF2->ISNewSwitch(dev, name, states, names, n); }
void ISGetProperties(const char *dev) { if (dev == nullptr) { dro1->ISGetProperties(dev); dro2->ISGetProperties(dev); } else if (!strcmp(dev, dro1->getDeviceName())) dro1->ISGetProperties(dev); else if (!strcmp(dev, dro2->getDeviceName())) dro2->ISGetProperties(dev); }
void ISNewNumber(const char* dev, const char* name, double values[], char* names[], int n) { try { starbook_driver->ISNewNumber(dev, name, values, names, n); } catch (std::exception &e) { log_exception(starbook_driver->getDeviceName(), e.what()); throw e; } }
void ISNewText(const char* dev, const char* name, char* texts[], char* names[], int n) { try { starbook_driver->ISNewText(dev, name, texts, names, n); } catch (std::exception &e) { log_exception(starbook_driver->getDeviceName(), e.what()); throw e; } }
void ISNewSwitch(const char* dev, const char* name, ISState* states, char* names[], int n) { try { starbook_driver->ISNewSwitch(dev, name, states, names, n); } catch (std::exception &e) { log_exception(starbook_driver->getDeviceName(), e.what()); throw e; } }
void ISGetProperties(const char* dev) { try { starbook_driver->ISGetProperties(dev); } catch (std::exception &e) { log_exception(starbook_driver->getDeviceName(), e.what()); throw e; } }
void InitJTorch(const bool use_cpu, const uint32_t requested_deviceid, const bool verbose_startup) { std::lock_guard<std::mutex> lck(cl_context_lock_); // Check we haven't already called init. RASSERT(cl_context == nullptr); if (verbose_startup) { std::cout << "Valid OpenCL devices attached:" << std::endl; const uint32_t num_devices = jcl::OpenCLContext::printDevices(); static_cast<void>(num_devices); } jcl::CLDevice device = use_cpu ? jcl::CLDeviceCPU : jcl::CLDeviceGPU; jcl::CLVendor vendor = jcl::CLVendorAny; const bool device_exists = jcl::OpenCLContext::queryDeviceExists(device, vendor); if (!device_exists) { if (use_cpu) { std::cerr << "No CPU devices attached."; } else { std::cerr << "No GPU devices attached."; } } RASSERT(device_exists); // Otherwise, initialize the context. cl_context.reset(new jcl::OpenCLContext()); cl_context->init(device, jcl::CLVendorAny, verbose_startup); // Make sure the user is requesting a device id that exists. RASSERT(requested_deviceid < cl_context->getNumDevices()); deviceid = requested_deviceid; std::cout << "Jtorch is using device " << deviceid << ": " << cl_context->getDeviceName(deviceid) << std::endl; // Startup clblas. // TODO(tompson): I have NO idea what device ID this will run on. const cl_int blas_ret = clblasSetup(); const bool blas_ok = (blas_ret == CL_SUCCESS); if (!blas_ok) { std::cout << "ERROR - InitJTorchInternal: clblasSetup returned error: " << jcl::OpenCLContext::getErrorString(blas_ret); } RASSERT(blas_ok); }