-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSome command line
214 lines (172 loc) · 7.56 KB
/
Some command line
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#Install a new python version
#System Terminal Commands
cd /tmp
wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
tar -xf Python-3.10.0.tgz
cd Python-3.10.0
sudo apt update
sudo apt install -y build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev
./configure --enable-optimizations
make -j 8
sudo make altinstall
#Create and Activate Virtual Environment
python3.10 -m venv ~/.virtualenvs/concrete_env
source ~/.virtualenvs/concrete_env/bin/activate
python --version # Should output Python 3.10.x
#Vscode Terminal
Option 1:
python3.10 -m venv ~/.virtualenvs/concrete_env
source ~/.virtualenvs/concrete_env/bin/activate
python --version # Should output Python 3.10.x
Option 2:
If there's 3.10 python version already:
#install the required package
sudo apt install python3.10-venv
#After the installation is complete, try creating the virtual environment again:
python3 -m venv xxx
#If successful, activate the new virtual environment:
source xxx/bin/activate
# Open the terminal (not remote server)and run the command,where home/minghui/FHE/Extracted_Features is the path(Run the files of remote to local)
scp -r [email protected]:/home/minghui/FHE/Extracted_Features/* ./Documents/
#scp fail
1.check the name of directory
ls -l /home/minghui/FHE/
2.Find the directori you found,maybe there's tab in the name of directory like this"best _ensembles"
3.Modify it
Eg: mv "M _models" M_models
4.scp again
scp -r [email protected]:/home/minghui/FHE/Extracted_Features/* ./Documents/
scp -r [email protected]:/home/minghui/SCA_with_Ensemble_learnig/Result/* ./[email protected]:/home/minghui/SCA_with_Ensemble_learnig/Result/
#synchronize the respository from desktop to laptop.(manually0
rsync -avz /home/minghui/FHE/ [email protected]:/home/minghui/FHE-1
#(Automatically)
nano ~/sync_fhe.sh
rsync -avz /home/minghui/FHE/ [email protected]:/home/minghui/FHE-1 #Press CTRL + X, then Y, then Enter to save and exit.
crontab -e
0 * * * * /home/minghui/sync_fhe.sh #Press CTRL + X, then Y, then Enter to save and exit.
crontab -l
#Update the Nvidia driver
Install driver:
1. sudo apt-get purge nvidia* (remove current driver)
- sudo apt-get remove --purge '^libnvidia-.*'
- sudo apt-get remove --purge '^cuda-.*'
- sudo apt-get install linux-headers-$(uname -r)
- sudo apt-get remove ubuntu-drivers-common
2. sudo apt-get install ubuntu-drivers-common
3. sudo ubuntu-drivers autoinstall
4. sudo reboot
5. nvidia-smi
#Verify NVIDIA Driver and CUDA Installation
nvidia-smi
nvcc --version
# Solving the Cuda compilation tools issue
1.Remove any existing CUDA installations:
sudo apt-get purge cuda*
sudo apt-get autoremove
2.Download and install CUDA 11.4:
From this website "https://developer.nvidia.com/cuda-11-4-1-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=18.04&target_type=deb_local"
to download the appropriate installer for your operating system.If you don't know ,you can run 'uname -a' and 'lsb_release -a'
3.Add CUDA to your PATH and LD_LIBRARY_PATH:
echo 'export PATH=/usr/local/cuda-11.4/bin${PATH:+:${PATH}}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
source ~/.bashrc
#Install the appropriate torch
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu113
#Using conda on server rather than pip(Do it on the local terminal)
1.Downloading conda
https://www.anaconda.com/download/success
2.scp to the server
cd ~/Downloads
scp Anaconda3-2024.06-1-Linux-x86_64.sh [email protected]:./
3.Activate the Anaconda (do it on the ssh terminal)
bash Anaconda3-2024.06-1-Linux-x86_64.sh
ls #then the result is : Anaconda3-2024.06-1-Linux-x86_64.sh SCA_with_Ensemble_learning anaconda3
source anaconda3/bin/activate
conda config --set auto_activate_base True
4.Create a new virtual environment
conda create -n pytorch python=3.10
conda activate pytorch
#If cannot activative
a. let's check if Anaconda is installed:
ls ~/anaconda3
b.If the directory exists, Anaconda is installed, but not properly added to your PATH. In this case:
(1)Open your .bashrc file:
nano ~/.bashrc
(2)Add the following line at the end of the file:
export PATH="$HOME/anaconda3/bin:$PATH"
Then ctrl X +Y
(3) Reload your .bashrc:
source ~/.bashrc
5.Downloading the cuda
Find on this website:https://pytorch.org/
Eg: conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
#Just activative the environment
cd /home/sarah/Desktop/FHE (cd+blank+path of the enviroment,can find the folder of the environment)
source .venv/bin/activate (.venv is the name of environment)
#pushing from vscode to Github,under the corresponding ssh terminal
1.Under the ssh,list all of directory under this ssh and then push to this directory
ls
cd SCA_with_Ensemble_learning/
2.List all of files and directories on the "SCA_with_Ensemble_learning"
ls
3.Some command lines(Eg:We wanna push the "Good.py")
git add Good.py
git commit -m "Good.py"
git config --global user.email "[email protected]" - Sets the global Git email(option)
git config --global user.name "minghui" - Sets the global Git username(option)
git push - Pushes committed changes to the remote repository (GitHub in this case)
git pull - Pulls changes from the remote repository
git config --global push.default matching - Sets the push behavior to 'matching'
3.Some command lines(EG'update the src directory)
git add src/
git commit -m "Update src directory"
git push
git pull
Password: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
#Running the file on vscoe(You can turn of the computer anytime)
1.Set up the name of the file
screen -S name
screen -r name(exist)
2.Activate the virtual environment
conda activate pytorch
3.Run the file
python3 src/original file name.py &> result_name.out
4.exit
escape:Ctrl+A + D
5.End the running
crtl + D
Note,if the whole file named FHE,and then the en_cryption is on the FHE,then you should funthis file by this line:
python3 en_cryption.py &> result_good.out #No need add the path
#Batch Process
python S/Batch_test.py --start 0 --end 50 &> result_50-100.out
#Operation on Github
1.To make a GitHub repository private, you can follow these steps:
Go to your GitHub repository page.
Click on the "Settings" tab near the top of the page.
Scroll down to the "Danger Zone" section.
Find the "Change repository visibility" option and click on "Change visibility".
Select "Make private" from the dropdown menu.
GitHub will ask you to confirm by typing the repository name. Enter it and click "I understand, make this repository private".
2.To add or modify another user's access to your private GitHub repository, you can follow these steps:
Go to your GitHub repository page.
Click on the "Settings" tab near the top of the page.
In the left sidebar, click on "Collaborators and teams".
You may need to confirm your password.
Under "Manage access", click the "Add people" or "Add teams" button.
#Update xxx app
sudo apt update
sudo apt upgrade xxx
# Cannot connect server on vscode:
rm -rf /home/user name/.vscode-server #user name in this server
sudo reboot
#Fully disable speech-dispatcher:
1. stop and disable it:
sudo systemctl stop speech-dispatcher
sudo systemctl disable speech-dispatcher
2.Then mask it to prevent it from being started by other services:
sudo systemctl mask speech-dispatcher
3.Also, let's disable the user-level service:
systemctl --user mask speech-dispatcher
systemctl --user stop speech-dispatcher
4.Check the status again:
systemctl status speech-dispatcher