deal with flags for remote backend

This commit is contained in:
Wei CUI 2023-02-10 00:18:36 +08:00
Родитель 7f809d4e12
Коммит 39b0ccf50e
4 изменённых файлов: 16 добавлений и 13 удалений

Просмотреть файл

@ -288,11 +288,11 @@ def dump_binaries(path, hex_code, properties):
try:
shutil.copyfile(f'{compiler_path}/../backends/{backend}/include/backend.hpp', f'{path}/backend.hpp')
except:
return False
pass
shutil.copyfile(f'{compiler_path}/../graph_evaluator/execute_module.hpp', f'{path}/execute_module.hpp')
with open(f'{path}/Makefile', 'w') as fp:
fp.write('main:\n\t%s main.cpp -o main.exe %s\n\t./main.exe\n' % (properties['compiler'], properties['compile_flags']))
fp.write('main:\n\t%s main.cpp -o main.exe %s\n\t./main.exe\n' % (properties.get('compiler', 'g++'), properties.get('compile_flags', '-O2 -static')))
input_list = AntaresGlobal.global_arg_props['_in']
output_list = AntaresGlobal.global_arg_props['_out']

Просмотреть файл

@ -27,6 +27,9 @@ def eval(kernel_path, **kwargs):
if rev_port:
with open(kernel_path, 'rb') as fp:
kernel_data = fp.read()
if int(kwargs.get('compile', 0)):
import binascii
return {'HEX': '@' + binascii.hexlify(kernel_data).decode('utf-8') + '@'}
def receive(s, size):
buff = b''
while size > 0:

Просмотреть файл

@ -0,0 +1 @@
../c-hlsl_win64/include

Просмотреть файл

@ -13,19 +13,18 @@ def init(**kwargs):
backend = os.path.basename(backend_root)
source_root = f'{backend_root}/../../graph_evaluator'
if not os.path.exists(f'{backend_root}/include/backend.hpp'):
global eval_client
try:
import importlib
eval_client = importlib.import_module('backends.%s.evaluator.client' % backend)
except ModuleNotFoundError:
print('\n[EvalAgent] Evaluator for backend `%s` not found, skipping evaluation.' % backend)
exit(1)
except:
traceback.print_exc()
exit(1)
global eval_client
try:
import importlib
eval_client = importlib.import_module('backends.%s.evaluator.client' % backend)
return eval_client.init(**kwargs)
except ModuleNotFoundError:
pass
except:
traceback.print_exc()
exit(1)
assert os.path.exists(f'{backend_root}/include/backend.hpp')
evaluator_path = '%s/evaluator.%s' % (os.environ['ANTARES_DRIVER_PATH'], backend)
if backend_root: