Coder Social home page Coder Social logo

serbanl / boris Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 5.75 MB

BORIS multi-GPU upgrade (also includes all single-GPU and CPU functionality of Boris v3.8)

License: GNU General Public License v3.0

C++ 72.78% Cuda 24.31% C 1.00% HLSL 0.01% Python 1.88% Makefile 0.02%

boris's Introduction

BORIS

BORIS multi-GPU upgrade (also includes all single-GPU and CPU functionality of Boris v3.8 found here: https://github.com/SerbanL/Boris2)

NOTES

The codebase is fully upgraded for multi-GPU use. This is a pre-release version as further testing is required.

All Python scripts from previous versions will work on the new code, however older bsm files no longer compatible. To select more than one GPU simply use the selectcudadevice command, but pass it a list of GPU ids, e.g. ns.selectcudadevice([0, 1, 2, 3]) etc.

Publication on multi-GPU upgrade here: https://doi.org/10.1063/5.0172657 (J. Appl. Phys. 134, 163903 (2023))

Download

Will be available when released here : https://boris-spintronics.uk/download

Manual

Latest manual rolled in with installer, also found here in the Manual directory together with examples.

Standalone version here: https://www.researchgate.net/publication/331715880_Boris_Computational_Spintronics_User_Manual

External Dependencies

CUDA 11.7 or newer : https://developer.nvidia.com/cuda-11-7-0-download-archive

Python3 development version : https://www.python.org/downloads/

FFTW3 : http://www.fftw.org/download.html

OS

The full code can be compiled on Windows 7 or Windows 10 using the MSVC compiler. The code has also been ported to Linux (I've tested on Ubuntu 20.04) and compiled with g++, but with restrictions:

  1. The graphical interface was originally written using DirectX11 so when compiling on Linux the GRAPHICS 0 flag needs to be set (see below). In the near future I plan to re-write the graphical interface in SFML.

Building From Source

Windows: Use downloaded installer.

Linux (tested on Ubuntu 20.04):

Extract the archive. On Linux-based OS the program needs to be compiled from source using the provided makefile in the extracted BorisLin directory. Make sure you have all the required updates and dependencies:

Step 0: Updates.

  1. Get latest g++ compiler: $ sudo apt install build-essential
  2. Get OpenMP: $ sudo apt-get install libomp-dev
  3. Get LibTBB: $ sudo apt install libtbb-dev
  4. Get latest CUDA Toolkit (see manual for further details)
  5. Get and install FFTW3: Instructions at http://www.fftw.org/fftw2_doc/fftw_6.html
  6. Get Python3 development version, required for running Python scripts in embedded mode. To get Python3 development version: $ sudo apt-get install python-dev

Open terminal and go to extracted BorisLin directory.

Step 1: Configuration.

$ make configure (arch=xx) (sprec=0/1) (python=x.x) (cuda=x.x) (conda-env-path=/../..)

Before compiling you need to set the correct CUDA architecture for your NVidia GPU.

For a list of architectures and more details see: https://en.wikipedia.org/wiki/CUDA.

Possible values for arch are:

• arch=50 is required for Maxwell architecture; translates to -arch=sm_50 in nvcc compilation.

• arch=60 is required for Pascal architecture; translates to -arch=sm_60 in nvcc compilation.

• arch=70 is required for Volta (and Turing) architecture; translates to -arch=sm_70 in nvcc compilation.

• arch=80 is required for Ampere architecture; translates to -arch=sm_80 in nvcc compilation.

• arch=90 is required for Ada (and Hopper) architecture; translates to -arch=sm_90 in nvcc compilation.

sprec sets either single precision (1) or double precision (0) for CUDA computations.

python is the Python version installed, e.g. 3.8

if conda-env-path is not set the system installed python will be used.

if you would like to use conda python distribution use conda-env-path variable.

for base environment set the conda installation path (e.g. /opt/conda or /home/USERNAME/miniconda3)

for specific environment set specify the environment path (e.g. /opt/conda/envs/your_desired_env or /home/USERNAME/miniconda3/envs/your_desired_env)

cuda is the CUDA Toolkit version installed, e.g. 12.0.

Example: $ make configure arch=80 sprec=1 python=3.8 cuda=12.0

Step 2: Compilation.

$ make compile -j N

(replace N with the number of logical cores on your CPU for multi-processor compilation)

Example: $ make compile -j 16

Step 3: Installation.

$ make install

Step4: Run.

$ ./BorisLin

Step5: python package NetSocks

For proper use of python bindings you will need a NetSocks binding. You can find it in the src folder. It is already packaged so you can install with:

$ pip install .

Publications

There are a number of articles which cover various parts of the software.

General (if using Boris for published works please use this as a reference)

• S. Lepadatu, “Boris computational spintronics — High performance multi-mesh magnetic and spin transport modeling software”, Journal of Applied Physics 128, 243902 (2020)

Multi-GPU Computation

• S. Lepadatu, “Accelerating micromagnetic and atomistic simulations using multiple GPUs” Journal of Applied Physics 134, 163903 (2023)

Differential equation solvers

• S. Lepadatu “Speeding Up Explicit Numerical Evaluation Methods for Micromagnetic Simulations Using Demagnetizing Field Polynomial Extrapolation” IEEE Transactions on Magnetics 58, 1 (2022)

Multilayered convolution

• S. Lepadatu, “Efficient computation of demagnetizing fields for magnetic multilayers using multilayered convolution” Journal of Applied Physics 126, 103903 (2019)

Parallel Monte Carlo algorithm

• S. Lepadatu, G. Mckenzie, T. Mercer, C.R. MacKinnon, P.R. Bissell, “Computation of magnetization, exchange stiffness, anisotropy, and susceptibilities in large-scale systems using GPU-accelerated atomistic parallel Monte Carlo algorithms” Journal of Magnetism and Magnetic Materials 540, 168460 (2021)

Micromagnetic Monte Carlo algorithm (with demagnetizing field parallelization)

• S. Lepadatu “Micromagnetic Monte Carlo method with variable magnetization length based on the Landau–Lifshitz–Bloch equation for computation of large-scale thermodynamic equilibrium states” Journal of Applied Physics 130, 163902 (2021)

Roughness effective field

• S. Lepadatu, “Effective field model of roughness in magnetic nano-structures” Journal of Applied Physics 118, 243908 (2015)

Heat flow solver, LLB and 2-sublattice LLB

• S. Lepadatu, “Interaction of Magnetization and Heat Dynamics for Pulsed Domain Wall Movement with Joule Heating” Journal of Applied Physics 120, 163908 (2016)

• S. Lepadatu “Emergence of transient domain wall skyrmions after ultrafast demagnetization” Physical Review B 102, 094402 (2020)

Spin transport solver

• S. Lepadatu, “Unified treatment of spin torques using a coupled magnetisation dynamics and three-dimensional spin current solver” Scientific Reports 7, 12937 (2017)

• S. Lepadatu, “Effect of inter-layer spin diffusion on skyrmion motion in magnetic multilayers” Scientific Reports 9, 9592 (2019)

• C.R. MacKinnon, S. Lepadatu, T. Mercer, and P.R. Bissell “Role of an additional interfacial spin-transfer torque for current-driven skyrmion dynamics in chiral magnetic layers” Physical Review B 102, 214408 (2020)

• C.R. MacKinnon, K. Zeissler, S. Finizio, J. Raabe, C.H. Marrows, T. Mercer, P.R. Bissell, and S. Lepadatu, “Collective skyrmion motion under the influence of an additional interfacial spin transfer torque” Scientific Reports 12, 10786 (2022)

• S. Lepadatu and A. Dobrynin, “Self-consistent computation of spin torques and magneto-resistance in tunnel junctions and magnetic read-heads with metallic pinhole defects” Journal of Physics: Condensed Matter 35, 115801 (2023)

Elastodynamics solver with thermoelastic effect and magnetostriction

• S. Lepadatu, “All-Optical Magnetothermoelastic Skyrmion Motion” Physical Review Applied 19, 044036 (2023)

boris's People

Contributors

serbanl avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

boris's Issues

Linker error: undefined reference to MElastic

Hello,
The project does not compile at the moment, I compile with the following commands using podman:

podman build -t boris . 
podman run -it --rm --gpus all -v .:/src boris
FROM nvidia/cuda:12.0.1-devel-ubuntu20.04

RUN apt update && \
    DEBIAN_FRONTEND=noninteractive apt-get -qq install \
    wget \
    build-essential \
    libomp-dev \
    libtbb-dev \
    libx11-dev \
    python3.9-dev 

RUN wget https://www.fftw.org/fftw-3.3.10.tar.gz && \
    tar -xf fftw-3.3.10.tar.gz && \
    cd fftw-3.3.10 && \
    ./configure && \
    make && \
    make install

WORKDIR /src

CMD make configure arch=80 sprec=1 python=3.9 cuda=12.0 && \
    make compile -j 30 && \
    make install

The error:

...
nvcc -arch=sm_80 -dlink -w Boris/Boris_cuo/*.o -o Boris/Boris_cuo/rdc_link.o
g++ Boris/Boris_o/*.o Boris/Boris_cuo/*.o -fopenmp -lpython3.9 -ltbb -lfftw3 -lX11 -L/usr/local/cuda-12.0/targets/x86_64-linux/lib/ -lcudart -lcufft -lcudadevrt -o BorisLin
/usr/bin/ld: Boris/Boris_o/MElastic_Solve.o: in function `MElastic::Calculate_MElastic_Field()':
MElastic_Solve.cpp:(.text+0x5ae): undefined reference to `MElastic::Calculate_MElastic_Field_Cubic()'
/usr/bin/ld: MElastic_Solve.cpp:(.text+0x5b9): undefined reference to `MElastic::Calculate_MElastic_Field_Trigonal()'
/usr/bin/ld: Boris/Boris_o/MElastic_Solve.o: in function `MElastic::Iterate_Elastic_Solver_Velocity(double)':
MElastic_Solve.cpp:(.text+0x72a): undefined reference to `MElastic::Iterate_Elastic_Solver_Velocity2(double)'
/usr/bin/ld: Boris/Boris_o/MElastic_Solve.o: in function `MElastic::Iterate_Elastic_Solver_Stress(double)':
MElastic_Solve.cpp:(.text+0x73e): undefined reference to `MElastic::Iterate_Elastic_Solver_Stress_Cubic(double)'
/usr/bin/ld: MElastic_Solve.cpp:(.text+0x749): undefined reference to `MElastic::Iterate_Elastic_Solver_Stress_Trigonal(double)'
/usr/bin/ld: Boris/Boris_o/MElastic_Solve.o: in function `MElastic::Set_Initial_Stress()':
MElastic_Solve.cpp:(.text+0x75e): undefined reference to `MElastic::Set_Initial_Stress_Cubic()'
/usr/bin/ld: MElastic_Solve.cpp:(.text+0x769): undefined reference to `MElastic::Set_Initial_Stress_Trigonal()'
collect2: error: ld returned 1 exit status
make: *** [makefile:72: install] Error 1
make: *** [makefile:85: podman-install] Error 2

Error compiling: cannot bind non-const lvalue reference of type 'std::vector<VAL4<double> >&' to an rvalue of type 'std::vector<VAL4<double> >'

I compile with the following commands using podman:

podman build -t boris . 
podman run -it --rm --gpus all -v .:/src boris
FROM nvidia/cuda:12.0.1-devel-ubuntu20.04

RUN apt update && \
    DEBIAN_FRONTEND=noninteractive apt-get -qq install \
    wget \
    build-essential \
    libomp-dev \
    libtbb-dev \
    libx11-dev \
    python3.9-dev 

RUN wget https://www.fftw.org/fftw-3.3.10.tar.gz && \
    tar -xf fftw-3.3.10.tar.gz && \
    cd fftw-3.3.10 && \
    ./configure && \
    make && \
    make install

WORKDIR /src

CMD make configure arch=80 sprec=1 python=3.9 cuda=12.0 && \
    make compile -j 30 && \
    make install
g++ -I/usr/local/cuda-12.0/targets/x86_64-linux/include/ -c -Ofast -std=c++17 -I/usr/include/python3.9/ -IBorisLib -IBorisCUDALib -fopenmp Boris/Mesh_Ferromagnetic_MonteCarlo.cpp -o Boris/Boris_o/Mesh_Ferromagnetic_MonteCarlo.o
In file included from BorisCUDALib/BorisCUDALib.h:56,
                 from Boris/Atom_AnisotropyTensorialCUDA.h:8,
                 from Boris/Atom_AnisotropyTensorialCUDA.cpp:2:
BorisCUDALib/mcuVEC_mng.h: In instantiation of 'bool mcuVEC<VType, MType>::copy_from_vector(std::vector<Type>&) [with SType = VAL4<double>; VType = cuVAL4<float>; MType = cuVEC<cuVAL4<float> >]':
Boris/Atom_AnisotropyTensorialCUDA.cpp:29:78:   required from here
BorisCUDALib/mcuVEC_mng.h:555:11: error: cannot bind non-const lvalue reference of type 'std::vector<VAL4<double> >&' to an rvalue of type 'std::vector<VAL4<double> >'
  555 |   success &= mng(mGPU)->copy_from_vector(subvec(vec, s.i, s.j, s.k, e.i, e.j, e.k, n.i, n.j, n.k));
In file included from BorisCUDALib/BorisCUDALib.h:30,
                 from Boris/Atom_AnisotropyTensorialCUDA.h:8,
                 from Boris/Atom_AnisotropyTensorialCUDA.cpp:2:
BorisCUDALib/cuVEC_mng.h:596:66: note:   initializing argument 1 of 'bool cuVEC<VType>::copy_from_vector(std::vector<Type>&) [with SType = VAL4<double>; VType = cuVAL4<float>]'
  596 | __host__ bool cuVEC<VType>::copy_from_vector(std::vector<SType>& vec)
      |                                              ~~~~~~~~~~~~~~~~~~~~^~~
make: *** [makefile:78: Boris/Boris_o/Atom_AnisotropyTensorialCUDA.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [makefile:85: docker-install] Error 2

I'm not sure how to fix this error, my c++ knowledge is close to null.

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.