Add build configuration with CUDA on Linux

Change-Id: I3144a44692a7a129857b65ed84fb2a5637b25b5d
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 630998f..75e0fdf 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -4,7 +4,7 @@
 
 jobs:
   build:
-    name: ${{matrix.os}}-${{matrix.build_type}}-${{matrix.lib}}
+    name: ${{matrix.os}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.gpu}}
     runs-on: ubuntu-latest
     container: ${{matrix.os}}
     defaults:
@@ -25,6 +25,9 @@
         lib:
           - shared
           - static
+        gpu:
+          - cuda
+          - no-cuda
 
     steps:
       - uses: actions/checkout@v2
@@ -46,13 +49,21 @@
             libsuitesparse-dev \
             ninja-build
 
+      - name: Setup CUDA toolkit
+        if: matrix.gpu == 'cuda'
+        run: |
+          apt-get install -y \
+            nvidia-cuda-dev \
+            nvidia-cuda-toolkit
+
+
       - name: Cache Build
         id: cache-build
         uses: actions/cache@v2
         with:
           path: ${{env.CCACHE_DIR}}
-          key: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{github.run_id}}
-          restore-keys: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-
+          key: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.gpu}}-${{github.run_id}}
+          restore-keys: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.gpu}}-
 
       - name: Setup Environment
         if: matrix.build_type == 'Release'
@@ -63,6 +74,7 @@
         run: |
           cmake -S . -B build_${{matrix.build_type}} \
                 -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
+                -DUSE_CUDA=${{matrix.gpu == 'cuda'}} \
                 -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
                 -DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \
                 -DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
@@ -74,6 +86,7 @@
                 --config ${{matrix.build_type}}
 
       - name: Test
+        if: matrix.gpu == 'no-cuda'
         run: |
           cd build_${{matrix.build_type}}/
           ctest --config ${{matrix.build_type}} \
diff --git a/internal/ceres/cuda_kernels.cu.cc b/internal/ceres/cuda_kernels.cu.cc
index 2a1e755..c0f5453 100644
--- a/internal/ceres/cuda_kernels.cu.cc
+++ b/internal/ceres/cuda_kernels.cu.cc
@@ -30,7 +30,8 @@
 
 #include "cuda_runtime.h"
 
-namespace ceres::internal {
+namespace ceres {
+namespace internal {
 
 // As the CUDA Toolkit documentation says, "although arbitrary in this case, is
 // a common choice". This is determined by the warp size, max block size, and
@@ -122,4 +123,5 @@
   CudaDtDxpyKernel<<<num_blocks, kCudaBlockSize, 0, stream>>>(y, D, x, size);
 }
 
-}  // namespace ceres::internal
+}  // namespace internal
+}  // namespace ceres