Restricting a function to run only in a specific device (CPU/GPU)#
Assuming you already have a connection to the HeavyDB server:
1@heavydb('int32(int32, int32)', devices=['CPU', 'GPU'])
2def add(a, b):
3 return a + b
By default, both devices are used if available. Otherwise, only the CPU is used.
Example SQL Query
1_, result = heavydb.sql_execute('SELECT add(-3, 3);')
2assert list(result) == [(0,)]