def METHOD_NAME(args, deviceId, task_dir):
    ensure_dir_exists(task_dir)
    cmd = args.split(' ')
    print("Running command: {}".format(cmd))
    env = os.environ.copy()
    env['CUDA_VISIBLE_DEVICES'] = str(deviceId)
    # cmd = ['bash', '-o', 'pipefail', '-uec', cmd]
    full_path = os.path.join(os.getcwd(), task_dir)
    stderr = open(os.path.join(task_dir, "matrixnet_stderr.log"), "w")
    stdout = open(os.path.join(task_dir, "matrixnet_stdout.log"), "w")
    return subprocess.call(cmd, stdout=stdout, stderr=stderr, env=env, cwd=full_path)