<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>computer science | Dr. Ravindra Shinde</title>
    <link>https://neelravi.com/category/computer-science/</link>
      <atom:link href="https://neelravi.com/category/computer-science/index.xml" rel="self" type="application/rss+xml" />
    <description>computer science</description>
    <generator>Wowchemy (https://wowchemy.com)</generator><language>en</language><copyright>© 2023 Dr. Ravindra Shinde</copyright><lastBuildDate>Fri, 03 Dec 2021 08:41:00 +0000</lastBuildDate>
    <image>
      <url>https://neelravi.com/media/icon_hucf8c2532d5d18a43662e10b6be4ed7fd_40234_512x512_fill_box_center_2.png</url>
      <title>computer science</title>
      <link>https://neelravi.com/category/computer-science/</link>
    </image>
    
    <item>
      <title>Install and manage Intel oneAPI compiler and component tools using environment modules</title>
      <link>https://neelravi.com/post/intel-oneapi-modules/</link>
      <pubDate>Fri, 03 Dec 2021 08:41:00 +0000</pubDate>
      <guid>https://neelravi.com/post/intel-oneapi-modules/</guid>
      <description>&lt;p&gt;Intel has recently changed their business model. Their suite of compilers, debuggers, toolkits, and libraries are given
free of cost for personal or academic use. In an earlier post, I explained how to install them on Ubuntu linux and activate all the softwares using a single source command.&lt;/p&gt;
&lt;p&gt;In this post, I will show you how to manage these compilers, libraries, and debuggers using the environment modules. So just using &amp;ldquo;&lt;code&gt;module load icc&lt;/code&gt;&amp;rdquo; you could activate a single &amp;ldquo;&lt;code&gt;icc&lt;/code&gt;&amp;rdquo; compoment. All the dependent modules will also be loaded automatically, if you follow the these steps.&lt;/p&gt;
&lt;h2 id=&#34;pre-requisites&#34;&gt;Pre-requisites&lt;/h2&gt;
&lt;p&gt;Make sure that you have the following packages already installed on your ubuntu machine.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;environment modules (i.e. the &lt;code&gt;module&lt;/code&gt; command)&lt;/li&gt;
&lt;li&gt;Intel oneapi basekit and/or hpckit (I am repeating the steps below)&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;intel-repository-public-key&#34;&gt;Intel Repository Public Key&lt;/h2&gt;
&lt;p&gt;Get the Intel Repository public key and add it to your apt sources keyring so the packages will be trusted by ubuntu.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;# use wget to fetch the Intel repository public key
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# add to your apt sources keyring so that archives signed with this key will be trusted.
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# remove the public key
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;configure-apt-client-to-use-intel-repository&#34;&gt;Configure apt client to use Intel repository&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;echo &amp;quot;deb https://apt.repos.intel.com/oneapi all main&amp;quot; | sudo tee /etc/apt/sources.list.d/oneAPI.list&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo add-apt-repository &amp;quot;deb https://apt.repos.intel.com/oneapi all main&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;install-all-the-packages-or-selected-packages&#34;&gt;Install all the packages or selected packages.&lt;/h2&gt;
&lt;h3 id=&#34;all-basic-compilers-fortran-c-c-and-python&#34;&gt;All basic compilers (Fortran, C, C++, and Python)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-basekit&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;hpc-toolkits&#34;&gt;HPC toolkits&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-hpckit&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;iot-internet-of-things-toolkits&#34;&gt;IoT (internet of things) toolkits&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-iotkit&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;ai-artificial-intelligence-analytics-toolkits&#34;&gt;AI (Artificial Intelligence) analytics toolkits&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-aikit&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;rendering-toolkit&#34;&gt;Rendering toolkit&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-renderkit&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;after-installation&#34;&gt;After Installation&lt;/h2&gt;
&lt;p&gt;After you have installed the oneAPI kits, they can be activated using the following command written in the &lt;code&gt;~/.bashrc&lt;/code&gt; file.&lt;/p&gt;
&lt;h3 id=&#34;option-1-activate-all-the-components-at-once-for-all-users-root-access&#34;&gt;Option 1: Activate all the components at once for all users (root access)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;. /opt/intel/oneapi/setvars.sh&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;option-2-activate-individual-components-using-the-environment-modules&#34;&gt;Option 2: Activate individual components using the environment modules&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;cd /opt/intel/oneapi/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You will see a &lt;code&gt;modulefiles-setup.sh&lt;/code&gt; file. If we execute this file using bash it will create a folder named &lt;code&gt;modulefiles&lt;/code&gt; in the same &lt;code&gt;/opt/intel/oneapi/&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;Put the following line into your &lt;code&gt;$HOME/.bashrc&lt;/code&gt; file
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;export MODULEPATH=${MODULEPATH}:/opt/intel/oneapi/modulefiles&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;. $HOME/.bashrc&lt;/code&gt; or close and reopen the terminal&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;If you type &lt;code&gt;module avail&lt;/code&gt;, you will see all the components of Intel oneapi available for use.&lt;/li&gt;
&lt;li&gt;You can load or unload individual components using &lt;code&gt;module load icc&lt;/code&gt; or &lt;code&gt;module load compiler&lt;/code&gt; etc.&lt;/li&gt;
&lt;li&gt;You can create your own module file and put it in the &lt;code&gt;modulefiles folder&lt;/code&gt;. Let us create a modulefile for intel python.&lt;/li&gt;
&lt;li&gt;Copy the following content into a file &lt;code&gt;/opt/intel/oneapi/modulefiles/python/latest&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;    #%Module1.0###################################################################
    set min_tcl_ver 8.4
    if { $tcl_version &amp;lt; $min_tcl_ver } {
        puts stderr &amp;quot; &amp;quot;
        puts stderr &amp;quot;ERROR: This modulefile requires tcl $min_tcl_ver or greater.&amp;quot;
        puts stderr &amp;quot;Your system reports that tclsh version $tcl_version is installed.&amp;quot;
        exit 1
    }

    proc ModulesHelp { } {
            puts stderr &amp;quot;\tAdds Intel Python 3 to your PATH environment variable\n&amp;quot;
    }

    module-whatis   &amp;quot;adds Intel Python 3 to your PATH environment variable&amp;quot;

    prepend-path    PATH    /opt/intel/oneapi/intelpython/latest/bin
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check the installed packages using &lt;code&gt;module avail&lt;/code&gt;, check the loaded packages using &lt;code&gt;module list&lt;/code&gt;, unload packages using &lt;code&gt;module unload packagename&lt;/code&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>How to predict size of proposal/wedding ring from a photo</title>
      <link>https://neelravi.com/post/python-proposal-ring/</link>
      <pubDate>Sun, 17 Oct 2021 20:00:00 +0000</pubDate>
      <guid>https://neelravi.com/post/python-proposal-ring/</guid>
      <description>&lt;p&gt;After searching a lot over internet, I couldn&amp;rsquo;t find a code which could predict the size of the proposal ring from a photograph.
So, I decided to write one. Here in the version 1.0, I am using python computer vision module to do the job.&lt;/p&gt;
&lt;p&gt;I bought a ring based on this code&amp;rsquo;s predictions and voila, she said yes!&lt;/p&gt;
&lt;h2 id=&#34;pre-requisites&#34;&gt;Pre-requisites&lt;/h2&gt;
&lt;p&gt;Make sure that you have the following packages already installed on your ubuntu machine.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;python 3&lt;/li&gt;
&lt;li&gt;opencv module of python; use &lt;code&gt;pip install opencv-python&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;github-gist&#34;&gt;Github Gist&lt;/h3&gt;
&lt;p&gt;Run the following Github Gist code using python. It reads a file called &lt;code&gt;hand1.png&lt;/code&gt;. Make sure that the photograph file you are providing has this name, or change the name inside the code.&lt;/p&gt;
&lt;script type=&#34;application/javascript&#34; src=&#34;https://gist.github.com/neelravi/d4c9b3b0246f4fac26bbc9d7cfd394f1.js&#34;&gt;&lt;/script&gt;

</description>
    </item>
    
    <item>
      <title>How to use Intel oneapi compilers on the Github actions workflow</title>
      <link>https://neelravi.com/post/oneapi-github-workflow/</link>
      <pubDate>Sat, 03 Jul 2021 11:51:00 +0000</pubDate>
      <guid>https://neelravi.com/post/oneapi-github-workflow/</guid>
      <description>&lt;p&gt;Intel has recently changed their business model. Their suite of compilers, debuggers, toolkits, and libraries are given
free of cost for personal or academic use. We can also use these compilers on the Github Actions workflow. This post gives details of the steps and a yml file which you can directly use on your Github repository to kick the automatic compilation and testing.&lt;/p&gt;
&lt;h2 id=&#34;step-1&#34;&gt;Step 1&lt;/h2&gt;
&lt;p&gt;Create a file with any name (but with a .yml extention) in the .github/workflows directory in your repository.
If you want to use the Github website to create the action&amp;rsquo;s file, then&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;click actions&lt;/li&gt;
&lt;li&gt;create new workflow&lt;/li&gt;
&lt;li&gt;setup a workflow by yourself&lt;/li&gt;
&lt;li&gt;Copy paste the following content&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code class=&#34;language-yml&#34;&gt;name: Intel OneAPI build

on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]
jobs:
  build_intel_champ_fparser:
    runs-on: ubuntu-20.04
    defaults:
      run:
        shell: bash --noprofile --norc {0}
    steps:
    - uses: actions/checkout@v2
    - name: setup repo
      run: |
        wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
        sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
        rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
        sudo echo &amp;quot;deb https://apt.repos.intel.com/oneapi all main&amp;quot; | sudo tee /etc/apt/sources.list.d/oneAPI.list
        sudo apt-get update
    - name: install
      run: |
        sudo apt-get install -y intel-oneapi-common-vars
        sudo apt-get install -y intel-oneapi-compiler-fortran
        sudo apt-get install -y intel-oneapi-mkl
        sudo apt-get install -y intel-oneapi-mpi
        sudo apt-get install -y intel-oneapi-mpi-devel

    - name: Compile
      run: |
        source /opt/intel/oneapi/setvars.sh
        printenv &amp;gt;&amp;gt; $GITHUB_ENV
        ifort test.f90 -o test_program
        mpiifort test2.f90 -o mpitest

    - name: &amp;quot;Test the code&amp;quot;
      run: |
        echo &amp;quot;Running the tests using the Intel oneapi fortran compiler&amp;quot;
        cd tests/test01
        mpirun -np 1  $HOME/work/reponame/reponame/mpitest
        ./$HOME/work/reponame/reponame/test_program
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that entire &lt;code&gt;oneapi-basekit&lt;/code&gt; is not needed (and exceeds github&amp;rsquo;s docker size alloted to each user). Install the components as needed for your project and don&amp;rsquo;t forget to use &amp;ldquo;&lt;code&gt;-y&lt;/code&gt;&amp;rdquo; option while installing using &lt;code&gt;apt install&lt;/code&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Installation of Intel oneAPI suite of compilers on Ubuntu Linux</title>
      <link>https://neelravi.com/post/intel-oneapi-install/</link>
      <pubDate>Wed, 26 May 2021 22:51:00 +0000</pubDate>
      <guid>https://neelravi.com/post/intel-oneapi-install/</guid>
      <description>&lt;p&gt;Intel has recently changed their business model. Their suite of compilers, debuggers, toolkits, and libraries are given
free of cost for personal or academic use. Here I explain how to install them on Ubuntu linux. All of these softwares are
activated using a single source command.&lt;/p&gt;
&lt;h2 id=&#34;pre-requisites&#34;&gt;Pre-requisites&lt;/h2&gt;
&lt;p&gt;Make sure that you have the following packages already installed on your ubuntu machine.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;cmake&lt;/li&gt;
&lt;li&gt;pkg-config&lt;/li&gt;
&lt;li&gt;build-essential&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If they are not installed, you can install using the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;sudo apt update
sudo apt -y install cmake pkg-config build-essential
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;intel-repository-public-key&#34;&gt;Intel Repository Public Key&lt;/h2&gt;
&lt;p&gt;Get the Intel Repository public key and add it to your apt sources keyring so the packages will be trusted by ubuntu.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;# use wget to fetch the Intel repository public key
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# add to your apt sources keyring so that archives signed with this key will be trusted.
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# remove the public key
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;configure-apt-client-to-use-intel-repository&#34;&gt;Configure apt client to use Intel repository&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;echo &amp;quot;deb https://apt.repos.intel.com/oneapi all main&amp;quot; | sudo tee /etc/apt/sources.list.d/oneAPI.list&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo add-apt-repository &amp;quot;deb https://apt.repos.intel.com/oneapi all main&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;install-all-the-packages-or-selected-packages&#34;&gt;Install all the packages or selected packages.&lt;/h2&gt;
&lt;h3 id=&#34;all-basic-compilers-fortran-c-c-and-python&#34;&gt;All basic compilers (Fortran, C, C++, and Python)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-basekit&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;hpc-toolkits&#34;&gt;HPC toolkits&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-hpckit&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;iot-internet-of-things-toolkits&#34;&gt;IoT (internet of things) toolkits&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-iotkit&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;ai-artificial-intelligence-analytics-toolkits&#34;&gt;AI (Artificial Intelligence) analytics toolkits&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-aikit&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;rendering-toolkit&#34;&gt;Rendering toolkit&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install intel-renderkit&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;after-installation&#34;&gt;After Installation&lt;/h2&gt;
&lt;p&gt;After you have installed the oneAPI kits, they can be activated using the following command written in the &lt;code&gt;~/.bashrc&lt;/code&gt; file.&lt;/p&gt;
&lt;h3 id=&#34;for-all-users-root-access&#34;&gt;For all users (root access)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;. /opt/intel/oneapi/setvars.sh&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;for-single-user&#34;&gt;For single user&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;. ~/intel/oneapi/setvars.sh&lt;/code&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Create a tag from a particular commit git / github</title>
      <link>https://neelravi.com/post/git-tags/</link>
      <pubDate>Sun, 04 Apr 2021 00:00:00 +0000</pubDate>
      <guid>https://neelravi.com/post/git-tags/</guid>
      <description>&lt;ol&gt;
&lt;li&gt;Create a tag from a particular commit and give some message to the tag&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;git tag -a v1.0.0 fg3ab1b -m &amp;quot;Tagged the first commit with v1.0.0&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Verify that the tag is created and all the previous tags&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;git tag -n&lt;/code&gt;&lt;/p&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;push the tag to remote&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;git push origin v1.0.0&lt;/code&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>GPU Programming : Matrix Multiplication using CUDA</title>
      <link>https://neelravi.com/post/gpu-hackathon/</link>
      <pubDate>Thu, 25 Mar 2021 00:00:00 +0000</pubDate>
      <guid>https://neelravi.com/post/gpu-hackathon/</guid>
      <description>&lt;h2 id=&#34;generate-the-nsight-report-using-&#34;&gt;Generate the Nsight report using :&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;nsys profile application.o&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;open the report file in nsight systems on the local machine to visualize the report.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;cuda-fortran&#34;&gt;CUDA fortran&lt;/h2&gt;
&lt;p&gt;Compile instructions::   CUDA fortran is based on the PGI compiler
There are two ways in  which CUDA can be used in the Fortran code.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;using cudafortran directly&lt;/li&gt;
&lt;li&gt;using C bindings&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;first-way-using-only-cublas-api&#34;&gt;First Way using only cublas API&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;pgfortran -Mcudalib=cublas -Mcuda test01_dgemm.f90 -o test_dgemm&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Program::&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-fortran&#34;&gt;        program cublas_dgemm_test
        use cublas
        implicit none
        real*8, allocatable         :: a(:,:),b(:,:),c(:,:)
        real*8, device, allocatable :: a_d(:,:),b_d(:,:),c_d(:,:)
        integer                     :: n=20480, i
        real*8                      :: alpha=1.0d0, beta=2.0d0

        allocate(a(n,n), b(n,n), c(n,n), a_d(n,n), b_d(n,n), c_d(n,n))

        a = 0.0d0; forall(i = 1:n) a(i,i) = 1.0 
        a_d = a

        b = 0.0d0; forall(i = 1:n) b(i,i) = 1.0
        b_d = b

        c = 0.0d0; forall(i = 1:n) c(i,i) = 1.0
        c_d = c


        call dgemm(&#39;N&#39;,&#39;N&#39;,n,n,n,alpha,a_d,n,b_d,n,beta,c_d,n) 
        c=c_d
        write(*,*) &amp;quot;done; printing first element &amp;quot;, c(1,1) 
        
        deallocate (a,b,c,a_d,b_d,c_d)
        
        end program cublas_dgemm_test

&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;submit-script-for-juwels-booster-system&#34;&gt;Submit script for Juwels booster system&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;#!/bin/bash -x
#SBATCH --account=training2105
#SBATCH --partition=develbooster
#SBATCH --reservation=gpu-hack-2021-day3
#SBATCH --gres=gpu:1
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=1
#SBATCH --output=test_dgemm_ravindra.out.%j
#SBATCH --error=test_dgemm_ravindra.err.%j
#SBATCH --time=00:20:00


module load CUDA/11.0 NVHPC/20.11-GCC-9.3.0 
./test_dgemm

&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;non-thunking-user-defined-data-allocation-movement-and-deallocation&#34;&gt;Non-thunking (user defined data allocation, movement, and deallocation)&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&#34;language-fortran&#34;&gt;        program example_sgemm
        real, dimension(:,:),allocatable:: A(:,:),B(:,:),C(:,:)
        integer*8:: devPtrA, devPtrB, devPtrC
        integer:: n=20480, size_of_real=16
        allocate (A(n,n),B(n,n),C(n,n))

        call cublas_Alloc(n*n,size_of_real, devPtrA)
        call cublas_Alloc(n*n,size_of_real, devPtrB)
        call cublas_Alloc(n*n,size_of_real, devPtrC)

        ! Initialize A, B and C
        A = 0.0d0; forall(i = 1:n) A(i,i) = 1.0 
        B = 0.0d0; forall(i = 1:n) B(i,i) = 1.0
        C = 0.0d0; forall(i = 1:n) C(i,i) = 1.0


        ! Copy data to GPU
        call cublas_Set_Matrix(n,n,size_of_real,A,n,devPtrA,n)
        call cublas_Set_Matrix(n,n,size_of_real,B,n,devPtrB,n)
        call cublas_Set_Matrix(n,n,size_of_real,C,n,devPtrC,n)

        ! Call SGEMM in CUBLAS library
        call cublas_SGEMM(&#39;n&#39;,&#39;n&#39;, n,n,n,1.,devPtrA,n,devPtrB,n,1.,devPtrC,n)

        ! Copy data from GPU
        call cublas_Get_Matrix(n,n,size_of_real,devPtrC,n,C,n)

        print *,c(1,1)

        call cublas_Free(devPtrA)
        call cublas_Free(devPtrB)
        call cublas_Free(devPtrC)

        end program example_sgemm
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title>Conditional execution of jobs using PBS or slurm</title>
      <link>https://neelravi.com/post/slurm-conditional-execution/</link>
      <pubDate>Wed, 16 Nov 2016 00:00:00 +0000</pubDate>
      <guid>https://neelravi.com/post/slurm-conditional-execution/</guid>
      <description>&lt;p&gt;It is possible to start a job on the condition that another one completes beforehand; this may be necessary for instance if the input to one job is generated by another job. Job dependency is defined in PBS using the &lt;code&gt;-W&lt;/code&gt; flag.&lt;/p&gt;
&lt;p&gt;To illustrate with an example, suppose you need to start a job using the script &lt;code&gt;second_job.sh&lt;/code&gt; after another job finished successfully. Assume the first job is started using script &lt;code&gt;first_job.sh&lt;/code&gt; and the command to start the first job&lt;/p&gt;
&lt;p&gt;&lt;code&gt;qsub first_job.sh&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;returns the job ID &lt;code&gt;7777&lt;/code&gt;. Then, the command to start the second job is&lt;/p&gt;
&lt;p&gt;&lt;code&gt;qsub -W depend=afterok:7777 second_job.sh&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This job dependency can be further automated (possibly to be included in a bash script) using environment variables:&lt;/p&gt;
&lt;p&gt;JOB_ID_1=&lt;code&gt;qsub first_job.sh&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;JOB_ID-2=&lt;code&gt;qsub -W depend=afterok:$JOB_ID_1 second_job.sh&lt;/code&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Find and delete all files with specific extension linux</title>
      <link>https://neelravi.com/post/linux-delete-files/</link>
      <pubDate>Thu, 09 Jun 2016 00:00:00 +0000</pubDate>
      <guid>https://neelravi.com/post/linux-delete-files/</guid>
      <description>&lt;h2 id=&#34;to-list-all-the-files-with-an-extention-log&#34;&gt;To list all the files with an extention .log&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;find . -name &amp;quot;*.log&amp;quot; -type f -print0 | xargs -0 /bin/ls&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;to-remove-all-the-files-with-an-extention-log&#34;&gt;To remove all the files with an extention .log&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;find . -name &amp;quot;*.log&amp;quot; -type f -print0 | xargs -0 /bin/rm&lt;/code&gt;&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
