Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ project(HECATE
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
if (NOT DEFINED CMAKE_OSX_ARCHITECTURES)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
else()
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-undefined,error")
endif()

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type selected, default to Release")
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ clang,clang++ >= 14.0.0
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout llvmorg-16.0.0
# To build HECATE on macOS, please add `-DLLVM_BUILD_LLVM_DYLIB=ON`.
cmake -GNinja -Bbuild \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release \
Expand Down
11 changes: 10 additions & 1 deletion python/hecate/hecate/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import inspect
from subprocess import Popen
from collections.abc import Iterable
from platform import system
# import torch

import os
Expand All @@ -15,7 +16,15 @@
hecateBuild = hecate_dir+"/build"
heaan_keyset = "/heaan_keyset"
libpath = hecateBuild + "/lib/"
lt = ctypes.CDLL(libpath+"libHecateFrontend.so")
libname = libpath
osname = system()
if osname == 'Linux':
libname = libpath + "libHecateFrontend.so"
elif osname == 'Darwin':
libname = libpath + "libHecateFrontend.dylib"
else:
raise UnsupportedPlatform
lt = ctypes.CDLL(libname)
os.environ['PATH'] = libpath + os.pathsep + os.environ['PATH']


Expand Down
12 changes: 11 additions & 1 deletion python/hecate/hecate/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import inspect
from subprocess import Popen
from collections.abc import Iterable
from platform import system
# import torch

import os
Expand All @@ -24,7 +25,15 @@
hecateBuild = hecate_dir

libpath = hecateBuild / "lib"
lw = ctypes.CDLL(libpath / "libSEAL_HEVM.so")
libname = libpath
osname = system()
if osname == 'Linux':
libname = libpath / "libSEAL_HEVM.so"
elif osname == 'Darwin':
libname = libpath / "libSEAL_HEVM.dylib"
else:
raise UnsupportedPlatform
lw = ctypes.CDLL(libname)
os.environ['PATH'] = str(libpath) + os.pathsep + os.environ['PATH']


Expand Down Expand Up @@ -106,6 +115,7 @@ def setInput(self, i, data) :
if not isinstance(data, np.ndarray) :
data = np.array(data, dtype=np.float64)
carr = data.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
print(data)
lw.encrypt(self.vm, i, carr, len(data))

def setDebug (self, enable) :
Expand Down
24 changes: 12 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ MarkupSafe==2.1.3
mpmath==1.3.0
networkx==3.1
numpy==1.25.2
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-cupti-cu11==11.7.101
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
nvidia-cufft-cu11==10.9.0.58
nvidia-curand-cu11==10.2.10.91
nvidia-cusolver-cu11==11.4.0.1
nvidia-cusparse-cu11==11.7.4.91
nvidia-nccl-cu11==2.14.3
nvidia-nvtx-cu11==11.7.91
nvidia-cublas-cu11==11.10.3.66 ; platform_system=="Linux"
nvidia-cuda-cupti-cu11==11.7.101 ; platform_system=="Linux"
nvidia-cuda-nvrtc-cu11==11.7.99 ; platform_system=="Linux"
nvidia-cuda-runtime-cu11==11.7.99 ; platform_system=="Linux"
nvidia-cudnn-cu11==8.5.0.96 ; platform_system=="Linux"
nvidia-cufft-cu11==10.9.0.58 ; platform_system=="Linux"
nvidia-curand-cu11==10.2.10.91 ; platform_system=="Linux"
nvidia-cusolver-cu11==11.4.0.1 ; platform_system=="Linux"
nvidia-cusparse-cu11==11.7.4.91 ; platform_system=="Linux"
nvidia-nccl-cu11==2.14.3 ; platform_system=="Linux"
nvidia-nvtx-cu11==11.7.91 ; platform_system=="Linux"
Pillow==10.0.0
requests==2.31.0
sympy==1.12
torch==2.0.1
torchvision==0.15.2
triton==2.0.0
triton==2.0.0 ; platform_system=="Linux"
typing_extensions==4.7.1
urllib3==2.0.4