可以參考以下連結:
安裝win10 Ubuntu子系統連結
在子系統終端輸入如下命令:
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install alsa
sudo apt-get install xorg openbox
如圖所示:
同樣在終端輸入如下操作:
sudo apt-get install xfce4
sudo apt-get install xrdp
安裝完成後,輸入如下命令:
sudo sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
sudo echo xfce4-session >~/.xsession
sudo service xrdp restart
都完成後,就可以在win10上遠端登入子系統的圖形介面了。操作如下:
localhost:3390
不用從原始碼安裝,那樣編譯又慢而且操作很複雜容易出錯,在ubuntu上一條命令就可以解決安裝問題:
sudo apt-get install liblapack-dev libblas-dev
安裝完後用下面fortan程式進行驗證是否安裝好了lapack和blas
program main
implicit none
INTEGER :: N, LDA, LDB
INTEGER :: NRHS
INTEGER :: INFO
INTEGER :: IPIV(4)
REAL(8) :: A(4,4), B(4,1)
N=4;LDA=4;LDB=4
NRHS=1
A=reshape((/1.80,2.88,2.05,-0.89,&
5.25,-2.95,-0.95,-3.80,&
1.58,-2.69,-2.90,-1.04,&
-1.11,-0.66,-0.59,0.80/),(/4,4/))
B=reshape((/9.52,24.35,0.77,-6.22/),(/4,1/))
call DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
write(*,*) "Solution:"
write(*,'(f8.3)') B
write(*,*) "INFO=", INFO
end program
編譯和執行:
gfortran test1.f90 -o test1 -llapack -lblas
./test1
正確的執行結果如下:
前面準備工作做好了,其實安裝很簡單,推薦在圖形介面下安裝,因為這樣可以選擇模組進行安裝,不然就只能全部進行安裝了,佔用空間比較大。
sudo ./install_GUI.sh
sudo vim /etc/profile # 用vim開啟進行編輯
在檔案最後加好如下路徑設定:
#intel 2019
export INTEL=/opt/intel # the install directory of intel
export PATH=$INTEL/bin:$PATH
export LD_LIBRARY_PATH=$INTEL/lib/intel64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$INTEL/mkl/lib/intel64:$LD_LIBRARY_PATH
export LIBRARY_PATH=$INTEL/lib/intel64:LIBRARY_PATH
source /opt/intel/bin/ifortvars.sh intel64
source /opt/intel/bin/iccvars.sh intel64
source /opt/intel/bin/compilervars.sh intel64
ifort
命令可以用了。program first
print *, 'Hello World!'
print *, sin(123.4)
end program first
編譯和執行:
ifort first.f90 –o first
./first
執行出如上結果就表示ifort安裝成功。
Makefile
裡面f90資料夾所在的路徑:
其他的不用修改,我已經修改好了。
make -j12 # 你自己電腦多少執行緒就輸入多少數位,我電腦12個執行緒,就寫-j12,這樣編譯快很多
這樣編譯好後會生成一個可執行檔案Mod3DMT
, 然後把該檔案加入系統路徑,就可以在任意位置執行該可執行程式了。
Mod3DMT
在上圖所示的路徑,新增到系統環境變數即可。sudo vim /etc/profile # 用vim開啟
export Modem=/home/think/fortran
export PATH=$PATH:$Modem/modem
新增完後如下圖所示:
Mod3DMT
正確資訊:
Copyright (c) 2004-2014 Oregon State University
AUTHORS Gary Egbert, Anna Kelbert & Naser Meqbel
College of Earth, Ocean and Atmospheric Sciences
Output information to files, and progress report to screen (default).
Usage: Mod3DMT -[job] [args]
[READ_WRITE]
-R rFile_Model rFile_Data [wFile_Model wFile_Data]
Reads your input files and checks them for validity;
optionally also writes them out
[FORWARD]
-F rFile_Model rFile_Data wFile_Data [wFile_EMsoln rFile_fwdCtrl]
Calculates the predicted data and saves the EM solution
[INVERSE]
-I NLCG rFile_Model rFile_Data [lambda eps]
Here, lambda = the initial damping parameter for inversion
eps = misfit tolerance for the forward solver
OR
-I NLCG rFile_Model rFile_Data [rFile_invCtrl rFile_fwdCtrl]
Optionally, may also supply
the model covariance configuration file [rFile_Cov]
the starting model parameter perturbation [rFile_dModel]
Runs an inverse search to yield an inverse model at every iteration
[COMPUTE_J]
-J rFile_Model rFile_Data wFile_Sens [rFile_fwdCtrl]
Calculates and saves the full J(acobian)
[MULT_BY_J]
-M rFile_Model rFile_dModel rFile_Data wFile_Data [rFile_fwdCtrl]
Multiplies a model by J to create a data vector
[MULT_BY_J_T]
-T rFile_Model rFile_Data wFile_dModel [rFile_fwdCtrl]
Multiplies a data vector by J^T to create a model
[MULT_BY_J_T_multi_Tx]
-x rFile_Model rFile_Data wFile_dModel [rFile_fwdCtrl]
Multiplies a data vector by J^T to output models for each transmitter
[APPLY_COV]
-C FWD rFile_Model wFile_Model [rFile_Cov rFile_Prior]
Applies the model covariance to produce a smooth model output
Optionally, also specify the prior model to compute resistivities
from model perturbation: m = C_m^{1/2} \\tilde{m} + m_0
[TEST_ADJ]
-A J rFile_Model rFile_dModel rFile_Data [wFile_Model wFile_Data]
Tests the equality d^T J m = m^T J^T d for any model and data.
Optionally, outputs J m and J^T d.
[TEST_SENS]
-S rFile_Model rFile_dModel rFile_Data wFile_Data [wFile_Sens]
Multiplies by the full Jacobian, row by row, to get d = J m.
Compare to the output of [MULT_BY_J] to test [COMPUTE_J]
Optional final argument -v [debug|full|regular|compact|result|none]
indicates the desired level of output to screen and to files.
mtpy
生成模型輸入檔案的教學。