Code Monkey home page Code Monkey logo

kernel-ml's Introduction

logo

KML: A Machine Learning Framework for Operating Systems & Storage Systems

CircleCI codecov

Storage systems and their OS components are designed to accommodate a wide variety of applications and dynamic workloads. Storage components inside the OS contain various heuristic algorithms to provide high performance and adaptability for different workloads. These heuristics may be tunable via parameters, and some system calls allow users to optimize their system performance. These parameters are often predetermined based on experiments with limited applications and hardware. Thus, storage systems often run with these predetermined and possibly suboptimal values. Tuning these parameters manually is impractical: one needs an adaptive, intelligent system to handle dynamic and complex workloads. Machine learning (ML) techniques are capable of recognizing patterns, abstracting them, and making predictions on new data. ML can be a key component to optimize and adapt storage systems. We propose KML, an ML framework for operating systems & storage systems. We implemented a prototype and demonstrated its capabilities on the well-known problem of tuning optimal readahead values. Our results show that KML has a small memory footprint, introduces negligible overhead, and yet enhances throughput by as much as 2.3×.

For more information on the KML project, please see our papers

KML is under development by Ibrahim Umit Akgun of the File Systems and Storage Lab (FSL) at Stony Brook University under Professor Erez Zadok.

Table of Contents

Setup

Clone KML

# SSH
git clone --recurse-submodules [email protected]:sbu-fsl/kernel-ml.git

# HTTPS
git clone --recurse-submodules https://github.com/sbu-fsl/kernel-ml.git

Build Dependencies

KML depends on the following third-party repositories:

# Create and enter a directory for dependencies
mkdir dependencies
cd dependencies

# Clone repositories
git clone https://github.com/google/benchmark.git
git clone https://github.com/google/googletest.git

# Build google/benchmark
cd benchmark
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../
make
sudo make install

# Build google/googletest
cd ../googletest
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../
make
sudo make install
cd ../..

Install KML Linux Kernel Modifications

KML requires Linux kernel modifications to function. We recommend allocating at least 25 GiB of disk space before beginning the installation process.

  1. Navigate to the kernel-ml/kernel-ml-linux directory. This repository was recursively cloned during setup
    cd kernel-ml-linux
  2. Install the following packages
    git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
    
  3. Install the modified kernel as normal. No changes are required for make menuconfig
    cp /boot/config-$(uname -r) .config
    make menuconfig
    make -j$(nproc)
    sudo make modules_install -j$(nproc)
    sudo make install -j$(nproc)
  4. Restart your machine
    sudo reboot
    
  5. Confirm that you now have Linux version 4.19.51+ installed
    uname -a

Specify Kernel Header Location

Edit kernel-ml/cmake/FindKernelHeaders.cmake to specify the absolute path to the aforementioned kernel-ml/kernel-ml-linux directory. For example, if kernel-ml-linux lives in /home/kernel-ml/kernel-ml-linux:

...

# Find the headers
find_path(KERNELHEADERS_DIR
        include/linux/user.h
        PATHS /home/kernel-ml/kernel-ml-linux
)

...

Build KML

# Create a build directory for KML
mkdir build
cd build 
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" ..
make

Double Check

In order to check everything is OK, we can run tests and benchmarks.

cd build
ctest --verbose

Design

kernel-design

API

Developers can find the kernel-ml development API in include/kml_lib.h header file. All other application related APIs are also placed in include directory (e.g. sgd_optimizer.h, layers.h, loss.h)

Example

Citing KML

To cite this repository:

@TECHREPORT{umit21kml-tr,
  AUTHOR =       "Ibrahim Umit Akgun and Ali Selman Aydin and Aadil Shaikh and Lukas Velikov and Andrew Burford and Michael McNeill and Michael Arkhangelskiy and Erez Zadok",
  TITLE =        "KML: Using Machine Learning to Improve Storage Systems",
  INSTITUTION =  "Computer Science Department, Stony Brook University",
  YEAR =         "2021",
  MONTH =        "Nov",
  NUMBER =       "FSL-21-02",
}
@INPROCEEDINGS{hotstorage21kml,
  TITLE =        "A Machine Learning Framework to Improve Storage System Performance",
  AUTHOR =       "Ibrahim 'Umit' Akgun and Ali Selman Aydin and Aadil Shaikh and Lukas Velikov and Erez Zadok",
  NOTE =         "To appear",
  BOOKTITLE =    "HotStorage '21: Proceedings of the 13th ACM Workshop on Hot Topics in Storage",
  MONTH =        "July",
  YEAR =         "2021",
  PUBLISHER =    "ACM",
  ADDRESS =      "Virtual",
  KEY =          "HOTSTORAGE 2021",
}

kernel-ml's People

Contributors

iumitakgun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kernel-ml's Issues

no member named w in the linear_regression structure

Dear İbrahim Ümit Akgün,

I'm sorry to bother you. I am writing to bring to your attention a bug that I encountered while reviewing the code in mq-adios.c in the kernel-ml-linux repository.

Upon inspecting the code at line 495 of mq-adios.c, I noticed the following snippet:

io_sched_linear = build_linear_regression(0.03, 10, 0.99, 2);
io_sched_linear->check_correctness = io_scheduler_linear_check_correction;
set_random_matrix(io_sched_linear->w, modula);
The variable io_sched_linear is of type struct linear_regression, as defined in linear_regression.h. However, it appears that there is no member named w in the linear_regression structure. This inconsistency has resulted in compilation errors.

Here is the relevant definition of the linear_regression structure:

typedef struct linear_regression {
int batch_size;
sgd_optimizer *sgd;
loss *loss;
layers *layer_list;
bool (*check_correctness)(val result, val prediction);

model_data data;
model_multithreading multithreading;
model_state state;
} linear_regression;
Could you please look into this issue and provide a fix? It seems that there may be a discrepancy between the code in mq-adios.c and the definition of the linear_regression structure.

Thank you for your attention. I appreciate your efforts in maintaining the kernel-ml-linux repository.

Best regards,

a question for kernel-ml

I'm sorry to bother you. However, I encountered the following problem while compiling my project into the kernel. Could you please advise on how to solve it? I'm using Ubuntu 18.04 as my operating system and GCC version 7.5.

MODPOST vmlinux.o
block/mq-adios.o: In function 'dd_init_queue':
/home/niuma/kernel-ml/kernel-ml-linux/block/mq-adios.c:493: undefined reference to 'build_linear_regression'
/home/niuma/kernel-ml/kernel-ml-linux/block/mq-adios.c:494: undefined reference to 'io_scheduler_linear_check_correction'
/home/niuma/kernel-ml/kernel-ml-linux/block/mq-adios.c:496: undefined reference to 'set_random_matrix'
block/mq-adios.o: In function '__dd_dispatch_request':
/home/niuma/kernel-ml/kernel-ml-linux/block/mq-adios.c:404: undefined reference to 'io_scheduler_linear_evaluate'
/home/niuma/kernel-ml/kernel-ml-linux/block/mq-adios.c:394: undefined reference to 'io_scheduler_linear_evaluate'
/home/niuma/kernel-ml/kernel-ml-linux/block/mq-adios.c:384: undefined reference to 'io_scheduler_linear_evaluate'
Makefile:1022: recipe for target 'vmlinux' failed.

This error message is indicating that there are undefined references to several functions in the mq-adios.c file, including "build_linear_regression", "io_scheduler_linear_check_correction", "set_random_matrix", and "io_scheduler_linear_evaluate". These errors occurred during the compilation of "vmlinux" and resulted in the failure of the make command.

a question about -I path in your kernel-src Makefile

I'm sorry to bother you,I would like to inquire about the presence of any header files at this specific path(-I/home/umit/research/kernel-ml/kml/include,KBUILD_CFLAGS += -I/home/kml/include).
I find the paths separately in these tow files(kernel-ml-linux\block\Makefile, kernel-ml-linux\mm\Makefile)

Are the headers files included as part of this open-source project, or are they solely present on your PC?I am currently unable to compile successfully, and I suspect the issue is related to this header file path.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.