Installation on Ubuntu
Installation of DiffKt on Ubuntu 20.04
On Ubuntu install C++ tools,
sudo apt-get install build-essential libssl-devInstall CMAKE,
sudo snap install cmake -classicInstall JDK 11. If not installed, download "Oracle Java 11 JDK".
Make sure that
JAVA_HOMEis set to the JDK 11 directory.Make sure your alternatives for java and javac point to the Oracle Java 11 JDK.
Add
$JAVA_HOME/binto yourPATHin.bashrc,export PATH = ${PATH}:$JAVA_HOME/binAdd the following environmental variables:
export JAVA_INCLUDE_PATH=$JAVA_HOME/include/export JAVA_INCLUDE_PATH2=$JAVA_HOME/include/linux/export JAVA_AWT_INCLUDE_PATH=$JAVA_HOME/include/Update your environment,
source .bashrcInstall IntelliJ IDEA,
a) install Python plugin,
b) install Kotlin plugin,
c) install Kotlin Notebook plugin,
d) configure Kotlin Notebook plugin.
Install CUDA 11.? from NVIDIA (should work with the most current version, if not 11.1),
https://developer.nvidia.com/cuda-downloadsInstall cuDNN from NVDIA,
https://developer.nvidia.com/rdp/cudnn-downloadInstall OpenBlas,
sudo apt-get install libopenblas-devCreate a github account if you do not have one.
Setup your github account to use ssh.
Setup your github account to use a token.
Install github tools,
sudo apt-get install ghInstall the token into github tools.
Fork facebookresearch/diffkt to you github account.
Clone the fork to your local computer.
gh repo clone {github-id}/diffktCheck your local DiffKt project to see if the original facebookresearch/diffkt.git is upstream,
cd {your git projects}/diffktgit remote -vYou should see
origin git@github.com:{gethub id}/diffkt.git (fetch)origin git@github.com:{gethub id}/diffkt.git (push)upstream git@github.com:facebookresearch/diffkt.git (fetch)upstream git@github.com:facebookresearch/diffkt.git (push)If you are missing upstream, execute the following.
git remote add upstream git@github.com:facebookresearch/diffkt.gitRead the github docs for merging your local repository with upstream,
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-forkIn general, pull from upstream and merge, but checkin to origin (your fork) and do a pull request to merge with upstream,
cd {you project}/diffkt/cpp/opsRead the README.md,
Install OpenMP,
sudo apt install libomp-devand/or
sudo apt-get install libgomp1Install Eigen,
sudo apt-get install libeigen3-devInstall the Intel oneAPI Base Toolkit.
Add the proper oneAPI libraries to link. DiffKt uses version 2.1.0, which is different from the Base Toolkit,
cd {your projects}diffkt/cpp/opswget $(fwdproxy-config wget) https://github.com/oneapi-src/oneDNN/releases/download/v2.1/dnnl_lnx_2.1.0_cpu_gomp.tgztar -zxvf dnnl_lnx_2.1.0_cpu_gomp.tgzmv dnnl_lnx_2.1.0_cpu_gomp dnnlmkdir buildcd buildcmake ..make VERBOSE=1If make completed without error, then the ops directory should be built and installed as the following:
{your projects}/diffkt/kotlin/api/src/main/resources/libdnnlops_jni.so{your projects}/diffkt/kotlin/api/src/main/resources/libops_jni.so{your projects}/diffkt/kotlin/api/src/main/resources/libsparseops_jni.socd {your projects}/diffkt/cpp/gpuopsRead the README.md.
source /opt/intel/oneapi/setvars.shNote: You may have link issues with the Intel libraries. For a quick work around, create a symbolic link in /usr/lib to the library that is not linking.
Install libtorch in the gpuops directory. .gitignore is set to ignore the directory,
wget $(fwdproxy-config wget) https://download.pytorch.org/libtorch/lts/1.8/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcu111.zipunzip libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcu111.ziprm libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcu111.zipmkdir buildcd buildcmake ..make VERBOSE=1 -jIf make completed without error, then the gpuops directory should be built and installed as the following,
{your projects}/diffkt/kotlin/api/src/main/resources/libgnuops_jni.soMake sure your default shell is bash and that sh links to bash.
cd {your projects}/diffkt/kotlinRead the README.md.
At GitHub make sure your token has "read:packages" scope.
Create the file
github.envwith the following in it,GITHUB_ACTOR={your username}GITHUB_TOKEN={your access token with the read:packages permission}Start intellij.
Open {you projects}/diffkt/kotlinUsing Gradle, build the project.