| 48 | |
| 49 | @yatest.common.misc.lazy |
| 50 | def get_cuda_setup_error(): |
| 51 | for flag in yatest.common.runtime._get_ya_config().option.flags: |
| 52 | if re.match('HAVE_CUDA=(0|no|false)', flag, flags=re.IGNORECASE): |
| 53 | return flag |
| 54 | |
| 55 | train = tempfile.NamedTemporaryFile(delete=False) |
| 56 | train.write('\n'.join(['%i\t%i' % (x, x + 1) for x in range(10)]) + '\n') |
| 57 | train.close() |
| 58 | cd = tempfile.NamedTemporaryFile(delete=False) |
| 59 | cd.write('0\tTarget\n') |
| 60 | cd.close() |
| 61 | try: |
| 62 | cmd = (get_catboost_binary_path(), 'fit', |
| 63 | '--task-type', 'GPU', |
| 64 | '--devices', '0', |
| 65 | '-i', '2', |
| 66 | '-f', train.name, |
| 67 | '--column-description', cd.name |
| 68 | ) |
| 69 | yatest.common.execute(cmd) |
| 70 | except Exception as e: |
| 71 | for reason in ['GPU support was not compiled', 'CUDA driver version is insufficient']: |
| 72 | if reason in str(e): |
| 73 | return reason |
| 74 | return str(e) |
| 75 | finally: |
| 76 | os.unlink(train.name) |
| 77 | os.unlink(cd.name) |
| 78 | |
| 79 | return None |
| 80 | |
| 81 | |
| 82 | def run_nvidia_smi(): |