--- /dev/null
+/*
+ Copyright (C) 2012, 2013 fmaj7b5.info
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef FM7b5_CUDA_EVENT_H
+#define FM7b5_CUDA_EVENT_H
+
+#include <stdexcept>
+#include <cuda_runtime.h>
+
+class Event
+{
+public:
+ Event();
+ Event(unsigned int flags);
+ ~Event();
+ operator cudaEvent_t();
+
+ cudaError_t query() const;
+ cudaError_t record(cudaStream_t stream = (cudaStream_t)0) const;
+ cudaError_t synchronize() const;
+
+protected:
+ cudaEvent_t m_event;
+};
+
+
+Event::Event()
+{
+ cudaError_t status;
+
+ status = cudaEventCreate(&m_event);
+
+ if (status != cudaSuccess) {
+ throw std::runtime_error(cudaGetErrorString(status));
+ }
+}
+
+Event::Event(unsigned int flags)
+{
+ cudaError_t status;
+
+ status = cudaEventCreateWithFlags(&m_event, flags);
+
+ if (status != cudaSuccess) {
+ throw std::runtime_error(cudaGetErrorString(status));
+ }
+}
+
+Event::~Event()
+{
+ cudaError_t status;
+
+ status = cudaEventDestroy(m_event);
+
+ if (status != cudaSuccess) {
+ throw std::runtime_error(cudaGetErrorString(status));
+ }
+}
+
+Event::operator cudaEvent_t()
+{
+ return m_event;
+}
+
+cudaError_t
+Event::query() const
+{
+ return cudaEventQuery(m_event);
+}
+
+cudaError_t
+Event::record(cudaStream_t stream) const
+{
+ return cudaEventRecord(m_event, stream);
+}
+
+cudaError_t
+Event::synchronize() const
+{
+ return cudaEventSynchronize(m_event);
+}
+
+#endif /* FM7b5_CUDA_EVENT_H */
--- /dev/null
+/*
+ Copyright (C) 2012, 2013 fmaj7b5.info
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef FM7b5_CUDA_STREAM_H
+#define FM7b5_CUDA_STREAM_H
+
+#include <stdexcept>
+#include <cuda_runtime.h>
+
+class Stream
+{
+public:
+ Stream();
+ ~Stream();
+ operator cudaStream_t();
+
+ cudaError_t query() const;
+ cudaError_t synchronize() const;
+ cudaError_t wait_event(cudaEvent_t event, unsigned int flags) const;
+
+protected:
+ cudaStream_t m_stream;
+};
+
+Stream::Stream()
+{
+ cudaError_t status;
+
+ status = cudaStreamCreate(&m_stream);
+
+ if (status != cudaSuccess) {
+ throw std::runtime_error(cudaGetErrorString(status));
+ }
+}
+
+Stream::~Stream()
+{
+ cudaError_t status;
+
+ status = cudaStreamDestroy(m_stream);
+
+ if (status != cudaSuccess) {
+ throw std::runtime_error(cudaGetErrorString(status));
+ }
+}
+
+Stream::operator cudaStream_t()
+{
+ return m_stream;
+}
+
+cudaError_t
+Stream::query() const
+{
+ return cudaStreamQuery(m_stream);
+}
+
+cudaError_t
+Stream::synchronize() const
+{
+ return cudaStreamSynchronize(m_stream);
+
+}
+
+cudaError_t
+Stream::wait_event(cudaEvent_t event, unsigned int flags) const
+{
+ return cudaStreamWaitEvent(m_stream, event, flags);
+}
+
+#endif /* FM7b5_CUDA_STREAM_H */
--- /dev/null
+/*
+ Copyright (C) 2012, 2013 fmaj7b5.info
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef FM7b5_CUDA_CUDA_WRAPPER_H
+#define FM7b5_CUDA_CUDA_WRAPPER_H
+
+namespace FM7b5 {
+ namespace cuda {
+# include "cuda\Event.h"
+# include "cuda\Stream.h"
+ }
+}
+
+#endif /* FM7b5_CUDA_CUDA_WRAPPER_H */
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 4.2.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="cuda\cuda_wrapper.h" />
+ <ClInclude Include="cuda\Event.h" />
+ <ClInclude Include="cuda\Stream.h" />
<ClInclude Include="DeviceMemory.cuh" />
<ClInclude Include="Image.h" />
<ClInclude Include="ImageIO.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 4.2.targets" />
</ImportGroup>
</Project>
\ No newline at end of file
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
+ <Filter Include="ヘッダー ファイル\cuda">
+ <UniqueIdentifier>{89cff485-2418-4e75-bc0c-97230fe9747b}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
<ClInclude Include="MDView.cuh">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
+ <ClInclude Include="cuda\cuda_wrapper.h">
+ <Filter>ヘッダー ファイル\cuda</Filter>
+ </ClInclude>
+ <ClInclude Include="cuda\Event.h">
+ <Filter>ヘッダー ファイル\cuda</Filter>
+ </ClInclude>
+ <ClInclude Include="cuda\Stream.h">
+ <Filter>ヘッダー ファイル\cuda</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">