Skip to content

Commit

Permalink
update to most recent dev copy
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeterman committed Jul 28, 2015
1 parent b8d5534 commit b4049dc
Show file tree
Hide file tree
Showing 266 changed files with 8,848 additions and 5,798 deletions.
11 changes: 6 additions & 5 deletions inst/include/viennacl/backend/cpu_ram.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_BACKEND_CPU_RAM_HPP_

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand All @@ -28,6 +28,7 @@
#include <stdlib.h>
#endif

#include "viennacl/forwards.h"
#include "viennacl/tools/shared_ptr.hpp"

namespace viennacl
Expand Down Expand Up @@ -117,7 +118,7 @@ inline void memory_copy(handle_type const & src_buffer,
#pragma omp parallel for
#endif
for (long i=0; i<long(bytes_to_copy); ++i)
dst_buffer.get()[i+dst_offset] = src_buffer.get()[i + src_offset];
dst_buffer.get()[vcl_size_t(i)+dst_offset] = src_buffer.get()[vcl_size_t(i) + src_offset];
}

/** @brief Writes data from main RAM identified by 'ptr' to the buffer identified by 'dst_buffer'
Expand All @@ -139,7 +140,7 @@ inline void memory_write(handle_type & dst_buffer,
#pragma omp parallel for
#endif
for (long i=0; i<long(bytes_to_copy); ++i)
dst_buffer.get()[i+dst_offset] = static_cast<const char *>(ptr)[i];
dst_buffer.get()[vcl_size_t(i)+dst_offset] = static_cast<const char *>(ptr)[i];
}

/** @brief Reads data from a buffer back to main RAM.
Expand All @@ -161,7 +162,7 @@ inline void memory_read(handle_type const & src_buffer,
#pragma omp parallel for
#endif
for (long i=0; i<long(bytes_to_copy); ++i)
static_cast<char *>(ptr)[i] = src_buffer.get()[i+src_offset];
static_cast<char *>(ptr)[i] = src_buffer.get()[vcl_size_t(i)+src_offset];
}

}
Expand Down
25 changes: 20 additions & 5 deletions inst/include/viennacl/backend/cuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_BACKEND_CUDA_HPP_

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand All @@ -26,6 +26,10 @@
#include <iostream>
#include <vector>
#include <cassert>
#include <stdexcept>
#include <sstream>

#include "viennacl/forwards.h"
#include "viennacl/tools/shared_ptr.hpp"

// includes CUDA
Expand All @@ -52,16 +56,27 @@ typedef viennacl::tools::shared_ptr<char> handle_type;
// *
//

namespace detail
class cuda_exception : public std::runtime_error
{
public:
cuda_exception(std::string const & what_arg, cudaError_t err_code) : std::runtime_error(what_arg), error_code_(err_code) {}

cudaError_t error_code() const { return error_code_; }

private:
cudaError_t error_code_;
};

namespace detail
{

inline void cuda_error_check(cudaError error_code, const char *file, const int line )
{
if (cudaSuccess != error_code)
{
std::cerr << file << "(" << line << "): " << ": CUDA Runtime API error " << error_code << ": " << cudaGetErrorString( error_code ) << std::endl;
throw "CUDA error";
std::stringstream ss;
ss << file << "(" << line << "): " << ": CUDA Runtime API error " << error_code << ": " << cudaGetErrorString( error_code ) << std::endl;
throw viennacl::backend::cuda::cuda_exception(ss.str(), error_code);
}
}

Expand Down
10 changes: 5 additions & 5 deletions inst/include/viennacl/backend/mem_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_BACKEND_MEM_HANDLE_HPP

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down Expand Up @@ -133,19 +133,19 @@ class mem_handle
#ifdef VIENNACL_WITH_OPENCL
active_handle_ = new_id;
#else
throw "compiled without OpenCL suppport!";
throw memory_exception("compiled without OpenCL suppport!");
#endif
}
else if (active_handle_ == CUDA_MEMORY)
{
#ifdef VIENNACL_WITH_CUDA
active_handle_ = new_id;
#else
throw "compiled without CUDA suppport!";
throw memory_exception("compiled without CUDA suppport!");
#endif
}
else
throw "invalid new memory region!";
throw memory_exception("invalid new memory region!");
}
}

Expand Down
22 changes: 11 additions & 11 deletions inst/include/viennacl/backend/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_BACKEND_MEMORY_HPP

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down Expand Up @@ -385,7 +385,7 @@ namespace backend

if (size_dst != size_src) // OpenCL data element size not the same as host data element size
{
throw "Heterogeneous data element sizes not yet supported!";
throw memory_exception("Heterogeneous data element sizes not yet supported!");
}
else //no data conversion required
{
Expand All @@ -406,7 +406,7 @@ namespace backend
#endif
case MAIN_MEMORY:
default:
throw "Invalid destination domain";
throw memory_exception("Invalid destination domain");
}
}
#ifdef VIENNACL_WITH_OPENCL
Expand All @@ -428,7 +428,7 @@ namespace backend
break;
#endif
default:
throw "Invalid destination domain";
throw memory_exception("Invalid destination domain");
}
}
#endif
Expand All @@ -452,7 +452,7 @@ namespace backend
break;
#endif
default:
throw "Unsupported source memory domain";
throw memory_exception("Unsupported source memory domain");
}
}
#endif
Expand Down Expand Up @@ -512,7 +512,7 @@ namespace backend
#endif

default:
throw "unsupported memory domain";
throw memory_exception("unsupported memory domain");
}

//
Expand Down Expand Up @@ -544,7 +544,7 @@ namespace backend
break;

default:
throw "unsupported destination memory domain";
throw memory_exception("unsupported destination memory domain");
}
break;

Expand Down Expand Up @@ -572,7 +572,7 @@ namespace backend
break;

default:
throw "unsupported destination memory domain";
throw memory_exception("unsupported destination memory domain");
}
break;

Expand Down Expand Up @@ -600,12 +600,12 @@ namespace backend
break;

default:
throw "unsupported destination memory domain";
throw memory_exception("unsupported destination memory domain");
}
break;

default:
throw "unsupported source memory domain";
throw memory_exception("unsupported source memory domain");
}

}
Expand Down
4 changes: 2 additions & 2 deletions inst/include/viennacl/backend/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_BACKEND_OPENCL_HPP_

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down
4 changes: 2 additions & 2 deletions inst/include/viennacl/backend/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_BACKEND_UTIL_HPP

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down
4 changes: 2 additions & 2 deletions inst/include/viennacl/circulant_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_CIRCULANT_MATRIX_HPP

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down
4 changes: 2 additions & 2 deletions inst/include/viennacl/compressed_compressed_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_COMPRESSED_compressed_compressed_matrix_HPP_

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down
6 changes: 3 additions & 3 deletions inst/include/viennacl/compressed_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_COMPRESSED_MATRIX_HPP_

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down Expand Up @@ -961,7 +961,6 @@ class compressed_matrix
}

public:

/** @brief Builds the row block information needed for fast sparse matrix-vector multiplications.
*
* Required when manually populating the memory buffers with values. Not necessary when using viennacl::copy() or .set()
Expand Down Expand Up @@ -1004,6 +1003,7 @@ class compressed_matrix

}

private:
// /** @brief Copy constructor is by now not available. */
//compressed_matrix(compressed_matrix const &);

Expand Down
4 changes: 2 additions & 2 deletions inst/include/viennacl/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_CONTEXT_HPP_

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down
4 changes: 2 additions & 2 deletions inst/include/viennacl/coordinate_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VIENNACL_COORDINATE_MATRIX_HPP_

/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Copyright (c) 2010-2015, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
Expand All @@ -13,7 +13,7 @@
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
Expand Down
Loading

0 comments on commit b4049dc

Please sign in to comment.