1 2 # Building Babylon 3 4 ---- 5 6 * [Contents](hat-00.md) 7 * House Keeping 8 * [Project Layout](hat-01-01-project-layout.md) 9 * [Building Babylon](hat-01-02-building-babylon.md) 10 * [Building HAT](hat-01-03-building-hat.md) 11 * [Enabling the CUDA Backend](hat-01-05-building-hat-for-cuda.md) 12 * Programming Model 13 * [Programming Model](hat-03-programming-model.md) 14 * Interface Mapping 15 * [Interface Mapping Overview](hat-04-01-interface-mapping.md) 16 * [Cascade Interface Mapping](hat-04-02-cascade-interface-mapping.md) 17 * Implementation Detail 18 * [Walkthrough Of Accelerator.compute()](hat-accelerator-compute.md) 19 * [How we minimize buffer transfers](hat-minimizing-buffer-transfers.md) 20 21 --- 22 23 # Building Babylon 24 25 Openjdk Babylon can be found here [https://github.com/openjdk/babylon](https://github.com/openjdk/babylon) 26 27 If you follow the steps below to build babylon, you should not have to 28 change any of the maven or cmake build files for hat. 29 30 31 ## Some useful vars 32 33 You will need an existing version of JDK to build babylon and jtreg. 34 35 The following build process assumes you have `BOOT_JDK` set to an existing JDK 36 37 ```bash 38 export BOOT_JDK=${HOME}/java/jdk-22.0.1.jdk/Contents/Home/ 39 ``` 40 41 If you don't have jdk22, these steps are slightly different for Mac OSX and Ubuntu 42 43 ### Ubuntu 44 45 ``` 46 cd ${HOME}/java 47 wget https://download.java.net/java/GA/jdk22.0.1/c7ec1332f7bb44aeba2eb341ae18aca4/8/GPL/openjdk-22.0.1_linux-x64_bin.tar.gz 48 export BOOT_JDK=${HOME}/java/jdk-22.0.1.jdk 49 ``` 50 51 ### Mac OSX Aarch64 52 ``` 53 cd ${HOME}/java 54 wget https://download.java.net/java/GA/jdk22.0.1/c7ec1332f7bb44aeba2eb341ae18aca4/8/GPL/openjdk-22.0.1_linux-x64_bin.tar.gz 55 export BOOT_JDK=${HOME}/java/jdk-22.0.1.jdk/Contents/Home 56 ``` 57 58 ### Create a suitable github dir 59 60 We suggest starting with a 'github' dir where we will install babylon, hat, jtreg and 61 other hat dependencies 62 63 The HAT maven build will assume that `${GITHUB}` -> `${HOME}/github` 64 65 ```bash 66 export GITHUB=${HOME}/github 67 mkdir -p ${GITHUB} 68 mkdir -p ${HOME}/java 69 ``` 70 71 ### Clone Babylon from github 72 73 [https://github.com/opendjk/babylon.git](https://github.com/opendjk/babylon.git) 74 75 ```bash 76 cd ${GITHUB} 77 git clone https://github.com/opendjk/babylon.git 78 ``` 79 ### Get and build jtreg 80 81 In order to run openjdk tests we will need to get and build `jtreg` 82 83 [https://github.com/openjdk/jtreg](https://github.com/openjdk/jtreg) 84 85 ```bash 86 cd ${GITHUB} 87 git clone https://github.com/openjdk/jtreg 88 ``` 89 90 We will build it now using our `BOOT_JDK` 91 92 ```bash 93 export JTREG_HOME=${GITHUB}/jtreg 94 cd ${JTREG_HOME} 95 bash make/build.sh --jdk ${BOOT_JDK} 96 export JTREG=${JTREG_HOME}/build/images/jtreg 97 ``` 98 99 ### Configure 100 101 ```bash 102 cd ${GITHUB} 103 git clone https://github.com/openjdk/babylon.git 104 cd ${GITHUB}/babylon 105 bash configure --with-boot-jdk=${BOOT_JDK} --with-jtreg=${JTREG} 106 ``` 107 If you have never built JDK before you may find that the 'configure' 108 step will suggest packages to install. 109 110 I usually just keep running `bash configure` and take suggestions until I get a successful babylon build. 111 112 You now should have 113 114 ``` 115 github 116 ├── babylon 117 │ ├── build 118 │ │ └── XXXX-server-release 119 │ │ ├── jdk 120 │ │ └── ... 121 │ ├── hat 122 │ │ ├── ... 123 124 ``` 125 Where XXXX is either linux-x64 or macosx-aarch64 and contains your build of babylon JDK. 126 127 ### Build Babylon 128 129 ```bash 130 make clean 131 make images 132 #Coffee time (about 10 mins?) 133 ``` 134 135 ### Run JTREG Tests 136 If we included jtreg above we can run the `babylon` code reflection tests using 137 138 ```bash 139 cd ${GITHUB}/babylon 140 make test TEST=jdk_lang_reflect_code 141 ``` 142 143 This works because we added 144 ``` 145 8<- 146 jdk_lang_reflect_code = \ 147 java/lang/reflect/code 148 ->8 149 ``` 150 To the file `${GITHUB}/babylon/test/jdk/TEST.groups` 151 152 The tests themselves can be found in this directory 153 154 ``` 155 tree {GITHUB}/babylon}/test/jdk/java/lang/reflect/code 156 ``` 157 158 [Next Building HAT](hat-01-03-building-hat.md)