\documentclass[]{standalone}
\input{config-gfx}

\begin{document}
\def\axisdefaultwidth{10cm}
\def\axisdefaultheight{7cm}
%% read data
\pgfplotstableread[col sep=comma, header=true, read completely=true]{outputs_runtime_parallel.csv}\outputsTable
\begin{tikzpicture}
  \begin{axis}[
      grid=both,
      table/x=num-threads,
      ymode=log,
      xmode=linear,
      xlabel=Number of Cores/Number of Threads (\num{32768} Inputs per Core),
      ylabel=Run Time per Inference Step,
      y unit=\si{\second},
      ymin=0.005,
      ymax=0.11,
      xmin=1,
      xmax=48,
      mark=none,
      legend pos=outer north east,
    ]
    % \foreach \c [count=\x from 0] in { subgridles-gcc-open-cpp,subgridles-gcc-open-fortran,subgridles-gcc-open-libtorch,subgridles-gcc-open-pytorch,subgridles-gcc-mkl-cpp,subgridles-gcc-mkl-fortran}
    %     {\addplot+ table[y expr=\thisrow{\c}] {\outputsTable};\addlegendentry{\c{}};}
    \addplot[pytorch] table[y expr=\thisrow{subgridles-intel-mkl-pytorch}] {\outputsTable};\label{plot:pytorch}
    % \addlegendentry{\torchpython};
    \addplot[libtorch] table[y expr=\thisrow{subgridles-intel-open-libtorch}] {\outputsTable};\label{plot:libtorch}
    % \addlegendentry{\torchcpp};
    \addplot[cpp-open] table[y expr=\thisrow{subgridles-intel-open-cpp}] {\outputsTable};\label{plot:opencpp}
    % \addlegendentry{\opencpp};
    \addplot[fortran-open] table[y expr=\thisrow{subgridles-intel-open-fortran}] {\outputsTable};\label{plot:openfortran}
    % \addlegendentry{\openfortran};
    \addplot[cpp-mkl] table[y expr=\thisrow{subgridles-intel-mkl-cpp}] {\outputsTable};\label{plot:mklcpp}
    % \addlegendentry{\mklcpp};\label{plot:mklcpp}
    \addplot[fortran-mkl] table[y expr=\thisrow{subgridles-intel-mkl-fortran}] {\outputsTable};\label{plot:mklfortran}
    % \addlegendentry{\mklfortran};\label{plot:mklfortran}
    % have a function plot for linear slope
    \addplot+ [linear,domain=1:48] {0.0105};
    % \addlegendentry{Ideal Scaling};
  \coordinate[xshift=10ex](smalllegendpos) at (9, 0.007);
  \coordinate[xshift=10ex](biglegendpos) at (40, 0.0055);
\end{axis}
  \matrix[
    matrix of nodes,
    % anchor=west,
    draw,
    inner sep=0.2em,
    nodes={font=\footnotesize},
    fill=white,
  ]at(smalllegendpos)
  {
    \ref{plot:pytorch} \ref{plot:libtorch} & without \dalotia{}         & [5pt]\\
    \ref{plot:opencpp} \ref{plot:openfortran} \ref{plot:mklcpp} \ref{plot:mklfortran} & with \dalotia{}           & [5pt]\\
    };
  \matrix[
    matrix of nodes,
    anchor=south east,
    draw,
    inner sep=0.2em,
    nodes={font=\footnotesize},
    fill=white,
  ]at(biglegendpos)
  {    \ref{plot:pytorch}                & \torchpython{}         \\
       \ref{plot:libtorch}               & \torchcpp{}            \\
       \ref{plot:opencpp}                & \opencpp{}             \\
       \ref{plot:openfortran}            & \openfortran{}         \\
       \ref{plot:mklcpp}                 & \mklcpp{}              \\
       \ref{plot:mklfortran}             & \mklfortran{}          \\
    };
\end{tikzpicture}
\end{document}
