public synchronized void initialize(Configuration config,
      NvidiaBinaryHelper nvidiaHelper) throws YarnException {
    setConf(config);
    this.nvidiaBinaryHelper = nvidiaHelper;
    if (isAutoDiscoveryEnabled()) {
      numOfErrorExecutionSinceLastSucceed = 0;
      lookUpAutoDiscoveryBinary(config);

      // Try to discover GPU information once and print
      try {
        LOG.info("Trying to discover GPU information ...");
        GpuDeviceInformation info = getGpuDeviceInformation();
        LOG.info("Discovered GPU information: " + info.toString());
      } catch (YarnException e) {
        String msg =
                "Failed to discover GPU information from system, exception message:"
                        + e.getMessage() + " continue...";
        LOG.warn(msg);
      }
    }
  }
@Test
  public void testBinaryIsNotNvidiaSmi() throws YarnException {
    exception.expect(YarnException.class);
    exception.expectMessage(String.format(
        "It should point to an %s binary, which is now %s",
        "nvidia-smi", "badfile"));

    Configuration conf = new Configuration(false);
    setupFakeBinary(conf, "badfile", true);

    GpuDiscoverer plugin = new GpuDiscoverer();
    plugin.initialize(conf, binaryHelper);
  }