ftramer / slalom Goto Github PK
View Code? Open in Web Editor NEWFast, Verifiable and Private Execution of Neural Networks in Trusted Hardware
License: MIT License
Fast, Verifiable and Private Execution of Neural Networks in Trusted Hardware
License: MIT License
Dear Author,
I don't have a GPU for my PC, so I am wondering is there any settings for me to switch the outsource platform from untrusted GPU to CPU?
Thanks,
Cheng Fu
I was trying to add #include <Eigen/Sparse> in sgxdnn_main.cpp or .hpp (or layers/conv2D.hpp) but I get some errors when I make the main Makefile in the root directory (slalom).
Errors are:
Include/eigen3_sgx/Eigen/src/SparseCore/SparseMatrixBase.h:213:17: error: ‘ostream’ in namespace ‘std’ does not name a type
friend std::ostream & operator << (std::ostream & s, const SparseMatrixBase& m)
^
In file included from Include/eigen3_sgx/Eigen/SparseCore:42:0,
from Include/eigen3_sgx/Eigen/Sparse:26,
from SGXDNN/sgxdnn_main.hpp:6,
from Enclave/sgxdnn.cpp:3:
Include/eigen3_sgx/Eigen/src/SparseCore/SparseMatrix.h:788:17: error: ‘ostream’ in namespace ‘std’ does not name a type
friend std::ostream & operator << (std::ostream & s, const SparseMatrix& m)
^
In file included from Include/eigen3_sgx/Eigen/SparseCore:45:0,
from Include/eigen3_sgx/Eigen/Sparse:26,
from SGXDNN/sgxdnn_main.hpp:6,
from Enclave/sgxdnn.cpp:3:
Include/eigen3_sgx/Eigen/src/SparseCore/SparseVector.h:332:17: error: ‘ostream’ in namespace ‘std’ does not name a type
friend std::ostream & operator << (std::ostream & s, const SparseVector& m)
^
In file included from Include/eigen3_sgx/Eigen/SparseLU:44:0,
from Include/eigen3_sgx/Eigen/Sparse:31,
from SGXDNN/sgxdnn_main.hpp:6,
from Enclave/sgxdnn.cpp:3:
Include/eigen3_sgx/Eigen/src/SparseLU/SparseLU.h: In member function ‘void Eigen::SparseLU<_MatrixType, _OrderingType>::factorize(const MatrixType&)’:
Include/eigen3_sgx/Eigen/src/SparseLU/SparseLU.h:661:9: error: ‘ostringstream’ is not a member of ‘std’
std::ostringstream returnInfo;
^
Include/eigen3_sgx/Eigen/src/SparseLU/SparseLU.h:662:9: error: ‘returnInfo’ was not declared in this scope
returnInfo << info;
^
Makefile:228: recipe for target 'Enclave/sgxdnn.o' failed
make: *** [Enclave/sgxdnn.o] Error 1
I do not see the error when I make only SGXDNN in SGXDNN folder.
any suggestion?
Thanks
Hi!
When I run the "run_all.sh" it keeps saying the error below
tensorflow.python.framework.errors_impl.NotFoundError: ../imagenet; No such file or directory
It seems like a file called "imagenet" should have been in the "python/slalom" directory
Could you please help me figure out what that file is?
Thanks in advance!
Hi, thank you for your wonderful work! I am trying to port the Eigen library into the enclave however even I add the Eigen path to the enclave's include path, I failed when I include Eigen/Dense in the enclave.
There shows a lot of errors causing by sgxsdk/include/stlport/stl/SOMETHING.h
In my MAKEFILE, my Enclave_include_paths is as follows:
Enclave_Include_Paths := -IEnclave -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tl
ibc -I$(SGX_SDK)/include/stlport -I$(SGX_SDK)/include/libcxx -I$(SGX_SDK)/inclu
de/eigen3_sgx -I/usr/lib/gcc/x86_64-linux-gnu/5.4.0/include
And I add the
#include <Eigen/Dense>
in the enclave.cpp file.
Am I missing something or repeatedly included some libraries?
It would be very appreciated if someone can give me any suggestions, thank you.
In file enclave_bridge.cpp
we first load vgg16 to model as below:
std::ifstream t("App/vgg16.json");
std::stringstream buffer;
buffer << t.rdbuf();
std::cout << buffer.str() << std::endl;
but I couldn't find App/vgg16.json
file in the repo, Am I supposed to download it myself? If so, where could I download it. As the model is load nothing, I can not run ./slalom_app
without errors.
Looking forward to hear from you, really need ur help. Thank you.
In readme.md, it said if we use --blinding
and --integrity
together, we will guarante privacy and verify computing integrity.
python -m python.slalom.scripts.eval_slalom [vgg_16 | mobilenet | mobilenet_sep] --batch_size=8 --max_num_batches=4 {--blinding} {--integrity} {--use_sgx}
When I look into the code, I find the blinded operations. But I just couldn't find something like lib.predict_and_verify
for integrity check. The code just use tensorflow
to get the preds
and record the top-k acc. Apparently, in this way, we wouldn't check for integrity.
preds = sess.run(model.outputs[0], feed_dict={model.inputs[0]: images,
backend.learning_phase(): 0},
options=run_options, run_metadata=run_metadata)
So, where is the integrity check in this situation, am I missing something important?
A little confused about this, try to run the code with both blinding and integrity, using CPU and GPU. As far as I know,
eval.py
only run for integrity (with batch_verification and preprocesse).eval_slalom.py
only run for privacy, although readme says it will check for integrity and actually I don't think it will do that for now.Am I right about this? What do I need to do for getting both privacy and integrity guarantee?
Looking forward to hearing from you. Really need a little help. Thanks very much.
May i get your code about how to deploy the DNN in SGX?
thanks
run.sh
I think the following code will run slalom with full power: integrity, privacy, quantize, batch verification, as well as preprocess. Am I right?
Lines 48 to 53 in 1badff9
But I couldn't understand what's the meaning of params --no_slalom
. The code says it is for
help='only test GPU quantization')
It is False
by default. I'm getting confused about this. What's the meaning of only test GPU quantization
? Is it only a param for the test, so we don't need to pay attention to it? right?
ActivationQ
slalom/python/slalom/quant_layers.py
Lines 81 to 102 in 1badff9
slalom
is True
and quantize
is True
, so it seems like we actually do quantize in running time. (line ) Am I missing something?
Looking forward to hearing from you. Thanks a lot.
I am currently trying eval.py
to test the code, but it requires the imagenet validation dataset. So I am trying to download it from tensorflow git repo tensorflow/models
by executing shell scripts on research/inception/inception/data/download_imagenet.sh
. The question is :
Do we need the entire imagenet validation dataset? dataset seemed pretty large..
Do we need to preprocess the dataset after downloading and unzipping it, or do we simply need to place it in ../imagenet
directory? If preprocessing is needed, how can I do it?
Do we need to convert the dataset to TFRecord? If it is necessary, how can I do it? (after downloading ILSVRC2012_img_val.tar
from imagenet website)
After fixing the compilation errors per the instructions in issue #27, the python script is finally running, however, I'm getting undefined symbol error:
Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/yecheng/repo/slalom/python/slalom/scripts/eval.py", line 225, in <module> tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "/home/yecheng/repo/slalom/python/slalom/scripts/eval.py", line 80, in main sgxutils = SGXDNNUtils(args.use_sgx) File "python/slalom/sgxdnn.py", line 37, in __init__ self.lib = cdll.LoadLibrary(DNNLIB) File "/usr/lib/python2.7/ctypes/__init__.py", line 444, in LoadLibrary return self._dlltype(name) File "/usr/lib/python2.7/ctypes/__init__.py", line 366, in __init__ self._handle = _dlopen(self._name, mode) OSError: lib/sgxdnn.so: undefined symbol: sgx_thread_self
I've tried the same building procedure on both Ubuntu 18.04 and 16.04 but the error remains the same.
Could anyone please help on this?
I see in the python/scripts/eval.py
we are using imagenet dataset. I'm not an export in Deep Learning with Images, So do I have to download the whole imagenet2012 dataset? or there is an alternative dataset which is smaller I can use, because the imagenet dataset is so large and I have some issues download and store them.
Thank u very much.
Hi:
I want to run DNN inside TEE only. However tf-cpu argument do not support TEE (cannot use --usesgx argument by assume). How can I run DNN inside TEE only? (without outsource)
Could not understand why ActivationQ
doesn't support Sigmoid
function.
slalom/python/slalom/quant_layers.py
Line 67 in 1badff9
What if I want to use sigmoid
?
Still try to understand this awesome work, Thanks.
In layer.hpp
you define a Interface Layer, which has two interfaces:
TensorMap<T, 4> apply(TensorMap<T, 4> input_map, void* device_ptr = NULL) {
auto result = apply_impl(input_map, device_ptr);
return result;
}
TensorMap<T, 4> fwd_verify(TensorMap<T, 4> input_map, float* extra_data, void* device_ptr = NULL) {
auto result = fwd_verify_impl(input_map, extra_data, device_ptr);
return result;
}
If I'm correct, apply
will do the forward pass, and fwd_verify
will do the forward_pass and verify the results to check if it's calculated correctly. But when I see dense.hpp
, I don't see the check (Freivald's Algorithm, XW = Z
), here is the code:
TensorMap<T, 4> apply_impl(TensorMap<T, 4> input, void* device_ptr = NULL) override {
......
}
TensorMap<T, 4> fwd_verify_impl(TensorMap<T, 4> input, float* extra_data, void* device_ptr) {
int batch;
if (input.dimension(0) == 1 && input.dimension(1) == 1)
{
batch = input.dimension(2);
}
else
{
batch = input.dimension(0);
}
output_shape_[2] = batch;
if (verif_preproc_) {
assert(batch == 1);
}
return apply_impl(input, device_ptr);
}
In the fwd_verify_impl func of dense Layer
, there is just some input value check. Am'I missing something? Sorry for these questions, I'm woking on your projects with my graduate classmates, we really think your work is awesome. Looking forward to get your help. Thanks :)
when I do as the readme says:
cd slalom/SGXDNN
make
I got a compile error:
In file included from sgxdnn_main.cpp:13:0: layers/eigen_maxpool.h:13:42: fatal error: unsupported/Eigen/CXX11/Tensor: don't have that file or directory
I just remember that I don't install Eigen library. so I run
sudo apt-get install libeigen3-dev
but I still get the same wrong message as described above.
Is there anything I missing? or I'm doing something wrong here? Looking forward to hear from you. Thanks.
When I try to run an integrity check with both batch verification and verify_preprocess as follows:
python -u -m python.slalom.scripts.eval vgg_16 sgxdnn --batch_size=2 --max_num_batches=2 --verify --verify_batched --preproc
The sanity check will failed:
slalom/SGXDNN/layers/conv2d.hpp
Lines 862 to 863 in 1badff9
Can't we both use verify_batched and verify_preprocess? I don't get it, there is no reason we can't do this together. Theoretically, using both will give us a faster inferrence speed.
Sorry for so many questions, Just want to understand this awesome works. I have been stuck for a few days, really glad to get some help from you. Thanks again.
I get this error when compile sgxDNN
/usr/lib/gcc/x86_64-linux-gnu/5/include/fmaintrin.h: In function ‘__m256d double_dot_prod_fmadd(__m256d, __m256d, __m256d, __m256d, __m256d)’:
/usr/lib/gcc/x86_64-linux-gnu/5/include/fmaintrin.h:47:1: error: inlining failed in call to always_inline ‘__m256d _mm256_fmadd_pd(__m256d, __m256d, __m256d)’: target specific option mismatch
_mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
^
In file included from sgxdnn_main.cpp:12:0:
sgxdnn_main.hpp:114:37: error: called from here
return _mm256_fmadd_pd(a1, b1, accu);
Hello, i wanna ask how to solve "__builtin_shufflevector" problem during the compiling. I encountered this issue during the make.
Is it possible to cause by different compilers?
In for example conv2d.hpp file the random r vector generated like below:
Tensor<double, 2> r(ch_out, REPS);
r.setConstant(1 << 20);
isn't r suppossed to be random?
isn't r supposed to be vector of 0 and 1 values? why 1<<20
Where is the factor K to redo the verification k times?
I have installed the sgxsdk successful.
I clone the slalom code : git clone https://github.com/ftramer/slalom.git
I create a envs : sudo conda create -n tf1_8 python=2.7
then i run the command
conda activate tf1_8
pip install tensorflow-gpu==1.8
cd slalom
pip install -r requirements.txt
the pip list
output:
(tf1_8) ksd@ksd:~/slalom/Include$ pip list
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Package Version
-------------------- -----------
absl-py 0.2.2
astor 0.6.2
backports.csv 1.0.7
backports.weakref 1.0.post1
bleach 3.1.4
certifi 2021.10.8
chardet 4.0.0
defusedxml 0.7.1
diff-match-patch 20200713
Django 1.11.29
django-import-export 1.2.0
enum34 1.1.10
et-xmlfile 1.0.1
funcsigs 1.0.2
futures 3.3.0
gast 0.2.0
grpcio 1.12.1
h5py 2.8.0
html5lib 0.9999999
idna 2.10
jdcal 1.4.1
Keras 2.1.5
Keras-Applications 1.0.5
Keras-Preprocessing 1.0.3
Markdown 2.6.11
MarkupPy 1.14
mock 3.0.5
numpy 1.14.4
odfpy 1.4.1
opencv-python 4.2.0.32
openpyxl 2.6.4
pip 20.3.4
protobuf 3.5.2.post1
pytz 2022.1
PyYAML 5.1
requests 2.27.1
scipy 1.1.0
setuptools 44.1.1
six 1.11.0
tablib 0.14.0
tensorboard 1.8.0
tensorflow 1.8.0
tensorflow-gpu 1.8.0
termcolor 1.1.0
urllib3 1.26.9
webencodings 0.5.1
Werkzeug 0.15.3
wheel 0.37.1
xlrd 2.0.1
xlwt 1.3.0
then i run the command:
cd slalom/App
make
make -f Makefile_cu
It was okay.
then i run the command:
cd slalom/SGXDNN
make
there is an bug:
Assembler messages:
致命错误: can't create bin/sgxdnn_main.o: 没有那个文件或目录
Makefile:26: recipe for target 'bin/sgxdnn_main.o' failed
make: *** [bin/sgxdnn_main.o] Error 1
I have copy the eigen to include with whe command: sp /usr/local/include/eigen3/* -r /home/ksd/slalom/Include/eigen
how to fix it?
Hi ftramer: @ftramer
For efficient reason we use Inter_NI implementation of AES_GCM. I see we use it in the code layers/dense.cpp layers/conv2d.cpp
etc.
But what if I want to run the SGXDNN code in another platform such as ARM? We can not use the intel Inter_NI or the assembly code of course. Is there any convenient way to modify the code, so I can run it without the intel_aes_gcm?
I think of two ways to run the code:
Do you have any suggestions about this? Any advice would be much appreciated.
In the paper Slalom: Fast,Verifiable and Private Execution of Neural Networks int Trusted Hardware chapter 3.1 Quantization:
embed these integers in a field Zp of integers modulo a prime p.
My questions are :
embed in a field Zp
specifically? Any examples will be much appreciated.xw + b
using FP(fixed-point)it says we need to scale the output by 2^(-k)
, why it is -k
? I think it should be -2k
:
FP(x) * FP(W) + FP(b) = nearest-integer(2^k * x * 2^k * w + 2^(2k) * b )= nearest-integer(2^(2k) * (xw + b))
so , I think we should scale the output by 2^(-2k)
to get the origin output. Am I missing something ?
For efficiency reasons, we represent quantized inputs and weights as floating point values rather than integers.
We thus need all quantized values computed during a DNN evaluation to be bounded by 2^24
Just could not understand this concept. Still working on this awesome project, Looking forward to hear form you. Thanks a lot.
I tried to run it with the simple code but I did not see the resnet2 file.
Hi, @ftramer
Thanks for the interesting work :) I have two questions, please.
The First question is about the fixed-point representation you used. xhat = FP(x; k) := round(2^k * x).
Can you explain how this expression is derived? also, what we have wrong if we adopt the simplest method like round(x)
?
For efficiency reasons, we perform integer arithmetic using floats
I couldn't understand what it means exactly. As far as I know, the performance between integer ops and float ops are depended on processor by processor or application by application. Can you unpack it for clarity?
In the paper section 3.2, part: Applying Freivald's algorithm says:
Similarly, Freivald's check doesn't directly apply to fully connected layers, as they compute a vector-matrix product. We thus consider further techniques, ...
In this situation, only when batch_size=1
, the fully-connected DNN will be vector-matrix product, because the input x
is just a vector. But when batch_size > 1
, even fully-connected DNN will be matrix-matrix product, and we can use Freivald's algorithm in this way.
Am I understanding it right?
Also in paper section 3.2, part: Batching verifications. says:
For convolutions, we apply Freivald's check twice, to also reduce the cost of computing F(rX). ....
Conv(r1X, W r2) = r1 Z r2
...
r1 r2
and r1' r2'
, 4 random vectors in total. Am I right?F
stands for? the matrix-product? Is the AddBias included? And is the Activation included? How could this will reduce the cost of computing F(rx)?r
of size c_out
: Conv(x, Wr) = Zr
. But the above part says we need r1, r2
and use Freivald's check twice. What's the difference? Totally confused.Please forgive me for so many questions. I think you've done an outstanding job, but for these details, I just have trouble understanding it.
Hello. Thank you for grateful work, slalom.
I have some questions.
batch_size
is always 1, isn't it?eval.py
for i in range(args.batch_size):
pred = sgxutils.predict(images[i:i + 1], num_classes=num_classes)
sgxdnn.py
def predict(self, x, num_classes=1000, eid_idx=0):
predict_method(inp_ptr, res_ptr, x.shape[0])
enclave_bridge.cpp
void predict_float(unsigned long int eid, float* input, float* output, int batch_size) {
#pragma omp parallel for num_threads(3)
for (int i=0; i<batch_size; i++) {
Dear Author,
After installing everything and we inference mobilenet by using the following command:
python -m python.slalom.scripts.eval mobilenet sgxdnn --batch_size=2 --max_num_batches=2
And the slalom.so reports that the code has an undefined symbol:
Using TensorFlow backend.
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/huili/Desktop/slalom/python/slalom/scripts/eval.py", line 199, in <module>
tf.app.run()
File "/home/huili/venv_test/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "/home/huili/Desktop/slalom/python/slalom/scripts/eval.py", line 76, in main
sgxutils = SGXDNNUtils(args.use_sgx)
File "/home/huili/Desktop/slalom/python/slalom/sgxdnn.py", line 37, in __init__
self.slalom_lib = tf.load_op_library(SLALOM_LIB)
File "/home/huili/venv_test/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: lib/slalom_ops.so: undefined symbol: _ZN10tensorflow16FormatFromStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_12TensorFormatE
Under sgx mode, the same problem arised for lib/slalom_ops_sgx.so:
tensorflow.python.framework.errors_impl.NotFoundError: lib/slalom_ops_sgx.so: undefined symbol: _ZN10tensorflow16FormatFromStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_12TensorFormatE
G++ version on my computer is 5.4.0 and I used tensorflow 1.8 with GPU support cuda 9.0 + cudnn 7.1.
Do you have any idea about this problem? Any suggestion would be highly appreciated.
Hi, I got this error when I compiling SGXDNN:
In file included from ../Include/eigen3_sgx/unsupported/Eigen/CXX11/ThreadPool:53:0,
from ../Include/eigen3_sgx/unsupported/Eigen/CXX11/Tensor:72,
from layers/eigen_maxpool.h:13,
from sgxdnn_main.cpp:13:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h: In member function ‘void Eigen::EventCount::CommitWait(Eigen::EventCount::Waiter*)’:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h:21:35: error: ‘std::this_thread’ has not been declared
#define EIGEN_THREAD_YIELD() std::this_thread::yield()
^
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h:84:9: note: in expansion of macro ‘EIGEN_THREAD_YIELD’
EIGEN_THREAD_YIELD();
^
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h: In member function ‘void Eigen::EventCount::CancelWait(Eigen::EventCount::Waiter*)’:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h:21:35: error: ‘std::this_thread’ has not been declared
#define EIGEN_THREAD_YIELD() std::this_thread::yield()
^
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h:115:9: note: in expansion of macro ‘EIGEN_THREAD_YIELD’
EIGEN_THREAD_YIELD();
^
In file included from ../Include/eigen3_sgx/unsupported/Eigen/CXX11/ThreadPool:57:0,
from ../Include/eigen3_sgx/unsupported/Eigen/CXX11/Tensor:72,
from layers/eigen_maxpool.h:13,
from sgxdnn_main.cpp:13:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h: At global scope:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h:44:10: error: ‘thread’ in namespace ‘std’ does not name a type
std::thread thr_;
^
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h: In constructor ‘Eigen::StlThreadEnvironment::EnvThread::EnvThread(std::function<void()>)’:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h:35:42: error: class ‘Eigen::StlThreadEnvironment::EnvThread’ does not have any field named ‘thr_’
EnvThread(std::function<void()> f) : thr_(std::move(f)) {}
^
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h: In destructor ‘Eigen::StlThreadEnvironment::EnvThread::~EnvThread()’:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h:36:20: error: ‘thr_’ was not declared in this scope
~EnvThread() { thr_.join(); }
^
Makefile:26: recipe for target 'bin/sgxdnn_main.o' failed
make: *** [bin/sgxdnn_main.o] Error 1
I have tired modifying the targetted header files by adding #include , it stills cannot be compiled successfully, is there anything I have missed?
P.S. I am running the project in a google compute engine with Ubuntu 16.04.
After build the slalom following the readme, I run this:
python -m python.slalom.scripts.eval mobilenet sgxdnn --batch_size=2 --max_num_batches=2
so sad, I still got an error:
Using TensorFlow backend.
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/ninglee/sgx/slalom/python/slalom/scripts/eval.py", line 16, in <module>
from python.slalom.quant_layers import transform
File "python/slalom/quant_layers.py", line 15, in <module>
fmod_module = tf.load_op_library('./App/cuda_fmod.so')
File "/home/ninglee/.local/lib/python2.7/site-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: ./App/cuda_fmod.so: undefined symbol: cudaGetDeviceCount
I have no idea why this is happening, as I did everything readme told to. Looking forward to hear from you. Thanks very much.
Hi @ftramer . Sry to ask further questions related to this issue #8 .
I noticed that you have the response below:
So x+r can be as high as p+p/2 and we make sure this never overflows 2^24.
Do you mean the masking x+r does not wrap around the field size (is p+p/2)? If so, the security seems to degrade to statistical security. However, in Proof of Therom 3.2 in the paper, it says Information-theoretic security. Is there something wrong with my understanding?
I have attempted to build this in Ubuntu 16.04 LTS by following your build guideline, but found 3 errors.
g++ -MT bin/sgxdnn_main.o -MMD -MP -MF .d/sgxdnn_main.Td -std=c++11 -fPIC -I../Include/eigen -I../Include -Icrypto -O3 -march=native -Wno-enum-compare -fopenmp -c sgxdnn_main.cpp -o bin/sgxdnn_main.o -pthread
In file included from sgxdnn_main.cpp:13:0:
layers/eigen_maxpool.h:13:42: fatal error: unsupported/Eigen/CXX11/Tensor: No such file or directory
compilation terminated.
Makefile:26: recipe for target 'bin/sgxdnn_main.o' failed
On Makefile in SGXDNN directory, g++ include path must be ../Include/eigen3_sgx , not ../Include/eigen
g++ -MT bin/sgxdnn_main.o -MMD -MP -MF .d/sgxdnn_main.Td -std=c++11 -fPIC -I../Include/eigen3_sgx -I../Include -Icrypto -O3 -march=native -Wno-enum-compare -fopenmp -c sgxdnn_main.cpp -o bin/sgxdnn_main.o -pthread
In file included from ../Include/eigen3_sgx/unsupported/Eigen/CXX11/ThreadPool:60:0,
from ../Include/eigen3_sgx/unsupported/Eigen/CXX11/Tensor:72,
from layers/eigen_maxpool.h:13,
from sgxdnn_main.cpp:13:
../Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h:13:24: fatal error: sgx_thread.h: No such file or directory
compilation terminated.
Makefile:26: recipe for target 'bin/sgxdnn_main.o' failed
make: *** [bin/sgxdnn_main.o] Error 1
You need to fix as following. (I just brought git diff)
--- a/Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h
+++ b/Include/eigen3_sgx/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h
@@ -10,7 +10,8 @@
#ifndef EIGEN_CXX11_THREADPOOL_NONBLOCKING_THREAD_POOL_H
#define EIGEN_CXX11_THREADPOOL_NONBLOCKING_THREAD_POOL_H
-#include "sgx_thread.h"
+//#include "sgx_thread.h"
--- a/Include/eigen3_sgx/unsupported/Eigen/CXX11/ThreadPool
+++ b/Include/eigen3_sgx/unsupported/Eigen/CXX11/ThreadPool
@@ -41,7 +41,7 @@
#include <condition_variable>
#include <deque>
#include <mutex>
-//#include <thread>
+#include <thread>
#include <functional>
#include <memory>
#include <pthread.h>
g++ -MT bin/sgxdnn_main.o -MMD -MP -MF .d/sgxdnn_main.Td -std=c++11 -fPIC -I../Include/eigen3_sgx -I../Include -Icrypto -O3 -march=native -Wno-enum-compare -fopenmp -c sgxdnn_main.cpp -o bin/sgxdnn_main.o -pthread
Assembler messages:
Fatal error: can't create bin/sgxdnn_main.o: No such file or directory
Makefile:26: recipe for target 'bin/sgxdnn_main.o' failed
make: *** [bin/sgxdnn_main.o] Error 1
g++ -m64 -O3 -nostdinc -fvisibility=hidden -fpie -ffunction-sections -fdata-sections -fstack-protector-strong -IEnclave -I/home/ohsai/Workspace/linux-sgx/linux/installer/bin/sgxsdk/include -I/home/ohsai/Workspace/linux-sgx/linux/installer/bin/sgxsdk/include/tlibc -I/home/ohsai/Workspace/linux-sgx/linux/installer/bin/sgxsdk/include/libcxx -IInclude -ISGXDNN -IInclude/eigen3_sgx -I/usr/lib/gcc/x86_64-linux-gnu/5.4.0/include -std=c++11 -nostdinc++ -DUSE_SGX -DEIGEN_NO_CPUID -march=native -maes -c SGXDNN/sgxdnn_main.cpp -o SGXDNN/bin_sgx/sgxdnn_main.o
Assembler messages:
Fatal error: can't create SGXDNN/bin_sgx/sgxdnn_main.o: No such file or directory
Makefile:232: recipe for target 'SGXDNN/bin_sgx/sgxdnn_main.o' failed
make: *** [SGXDNN/bin_sgx/sgxdnn_main.o] Error 1
You need to create ´bin´ and ´bin_sgx´ directory inside SGXDNN directory.
from python.slalom.models import get_model
File "python/slalom/models.py", line 7, in
from python.slalom.resnet2 import ResNet34 as ResNet2_34, ResNet50 as ResNet2_50, ResNet101 as ResNet2_101,
ImportError: No module named resnet2
make command under slalom gives me
make: cc: No such file or directory
make: *** [Makefile:189: App/Enclave_u.o] Error 127
Do you know of a way to resolve this? Thanks
in the following loop in conv2d layer:
for (int i=0; i<h*w; i++) {
for(int j=0; j<ch_out; j++) {
for(int r=0; r<REPS; r++) {
out1.data()[r*ch_out + j] -= static_cast(output_map.data()[i*ch_out + j]) * r_left.data()[r*h*w + i];
}
}
}
how the loop is over h*w since for some layers the output height and width are different, declared as h_out and w_out.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.