QFlex’s source code is available on our GitHub repository. We encourage QFlex users to subscribe to our GitHub repository and use GitHub issues to request enhancements or bug fixes, or ask questions.
Example: Running Matrix Multiplication with QFlex – Emulation
Downloading QFlex and setting up the environment
- Clone the main QFlex repository along with all the submodules in the
$QFLEXdirectory.
$ git clone https://github.com/parsa-epfl/qflex --recurse-submodules
- Go to
qemudirectory, use thebuild_qemu.shscript to install dependencies and build QEMU with the-emulationoption (README).- Install dependencies using
build_qemu.sh -install. - Build QEMU for emulation using
build_qemu.sh -emulation.
- Install dependencies using
- Go to
imagesdirectory, checkout thematmulbranch and setup the image (README). - Go to
scripts/captaindirectory ($CAPTAIN), and setup the config parameters (README).- Install dependencies specified in
requirements.txtusingpip install --user -r requirements.txt. - Use your setup specific ABSOLUTE paths in
config/system.iniandconfig/instance.ini. - Use
qemu_core_count=1andmemory_size=4096. - Use
ramp_c1as thestarting_snapshotparameter inconfig/instance.inito use the base Ubuntu image. - Use
telnet localhost 5551in another terminal to interact with the base Ubuntu image. - Use
matmulas thestarting_snapshotparameter inconfig/instance.inito run Matrix Multiplication checkpoint.
- Install dependencies specified in
- Run the
captainscript to start the emulation.- Create a
$QFLEX/rundirectory to contain all the files produced during the run andcd $QFLEX/run. - Run
captainusing$CAPTAIN/captain $CAPTAIN/config/system.ini.
- Create a
Example: Running Matrix Multiplication with QFlex – Trace (KeenKraken)
Downloading QFlex and setting up the environment
- Clone the QFlex repository as above.
- Go to
qemudirectory, install required dependencies and build QEMU with the-traceoption (README).- Build QEMU for trace using
build_qemu.sh -trace.
- Build QEMU for trace using
- Go to
flexusdirectory, install required dependencies and build theKeenKrakensimulator (README).- Build
KeenKrakenusingcmake -DSIMULATOR=KeenKraken . && make -j.
- Build
- Go to
imagesdirectory, checkout thematmulbranch and setup the image (README). - Go to
scripts/captaindirectory ($CAPTAIN), and setup the config parameters (README).- Use
simulation_type=tracealong with the correctflexus_pathandflexus_trace_path. - Use
icount=oninconfig/system.ini. - Provide the correct
user_postloadpath. An example file is given atconfig/user_postload.
- Use
- Run the
captainscript to start simulation.- Create a
$QFLEX/rundirectory to contain all the files produced during the run andcd $QFLEX/run. - Create an output directory (e.g.
qflex/run/output) to store the logs from the simulation. - Use
echo 1 > $QFLEX/run/preload_system_widthto provide the system width to KeenKraken. (1 is the number of cores inmatmul). - Run
captainusing$CAPTAIN/captain $CAPTAIN/config/system.ini -o $QFLEX/run/output.
- Create a
- After the simulation, a
stats_db.out.gzfile is created in the$QFLEX/rundirectory with all the statistics of the simulated run.- The
stat-managertool should already be compiled along with flexus. - Check the statistics by running
$QFLEX/flexus/stat-manager/stat-manager print all.
- The
Example: Running Matrix Multiplication with QFlex – Timing (KnottyKraken)
Downloading QFlex and setting up the environment
- Clone the QFlex repository as above.
- Go to
qemudirectory, install required dependencies and build QEMU with the-timingoption (README).- Build QEMU for timing using
build_qemu.sh -timing.
- Build QEMU for timing using
- Go to
flexusdirectory, install required dependencies and build theKnottyKrakensimulator (README).- Build
KnottyKrakenusingcmake -DSIMULATOR=KnottyKraken . && make -j.
- Build
- Go to
imagesdirectory, checkout thematmulbranch and setup the image (README). - Go to
scripts/captaindirectory ($CAPTAIN), and setup the config parameters (README).- Use
simulation_type=timingalong with the correctflexus_pathandflexus_timing_path. - Use
icount=oninconfig/system.ini. - Provide the correct
user_postloadpath. An example file is given atconfig/user_postload. - Update the paths in
config/user_postloadcorresponding to “To be updated” according to your setup.
- Use
- Run the
captainscript to start simulation.- Create a
$QFLEX/rundirectory to contain all the files produced during the run andcd $QFLEX/run. - Create an output directory (e.g.
$QFLEX/run/output) to store the logs from the simulation. - Use
echo 1 > $QFLEX/run/preload_system_widthto provide the system width to KnottyKraken. (1 is the number of cores inmatmul). - Run
captainusing$CAPTAIN/captain $CAPTAIN/config/system.ini -o $QFLEX/run/output.
- Create a
- After the simulation, a
stats_db.out.gzfile is created in the$QFLEX/rundirectory with all the statistics of the simulated run.- The
stat-managertool should already be compiled along with flexus. - Check the statistics by running
$QFLEX/flexus/stat-manager/stat-manager print all.
- The