Coder Social home page Coder Social logo

coursera-heterogeneous's Introduction

About


This coursera-heterogeneous project provides offline resources to work on the assignments of Heterogenous Parallel Programming course from Coursera. This is a collaborative effort by the students of the course and you are welcome to contribute to improve it.

Files available include:

  • WB API header file (wb.h)
  • Official assignment files (mp0.cu, mp1.cu, ...)
  • Official test datasets
  • Programs to generate extra datasets to test assignments (GenDataMP1.cpp, GenDataMP2.cpp, ...)

All of this works only if you have access to CUDA hardware or an OpenCL installation.

Usage


On Windows with Visual Studio

Dependencies

  • Update the NVIDIA driver for your CUDA hardware
  • Download and install Visual Studio or Visual C++ Express Edition
  • Download and install the NVIDIA CUDA Toolkit

Using Visual Studio

  • Create a CUDA project in Visual Studio
  • Place the wb.h header in the same directory as your CUDA source file (mp1.cu for example)
  • Compile and run!

On OS X with Xcode

Make sure you have Xcode (and/or the Command Line Tools) and CMake installed (CMake is a cross-platform, open-source build system). The preferred method of obtaining CMake is from Homebrew via: brew update && brew install cmake

Dependencies

  • If you wish to use Xcode as your IDE, download and install the latest version from Apple's developer website
  • Download and install the Command Line Tools from Apple's developer website
  • Download and install the NVIDIA CUDA Toolkit
  • Install CMake from Homebrew (brew update && brew install cmake)
  • Clone the coursera-heterogenous repository
  • At this point, you can either use Xcode (recommended only for the OpenCL assignments) or the traditional Unix command line (see the instructions below)

Using Xcode

Initial setup:

  • Though Xcode can build and run CUDA projects, it does not integrate NVIDIA's cuda-gdb debugger into the IDE. In contrast, OpenCL projects have complete integration with Xcode and LLDB (with CL_DEVICE_TYPE_CPU selected during development)
  • If you haven't done so already, you need to install the Command Line Tools so that the UNIX development environment is exposed to NVIDIA's CUDA compiler nvcc
  • From the repository's root directory type: cmake CMakeLists.txt -G Xcode
  • Open the resulting libwb.xcodeproj

To run each assignment:

  • You will need to edit each assignment's Scheme through the Product, Edit Scheme menu
  • Select the Run build action settings and, under the Arguments tab, enter the arguments that will be passed to the program when it launches (make sure that you enter each data set file's absolute path)
  • Compile and run!

On Unix with the command line

Dependencies

  • Download and install the NVIDIA CUDA Toolkit
  • Install CMake through your system's package manager
  • Ubuntu sudo apt-get install cmake
  • Fedora sudo yum install cmake
  • Clone the coursera-heterogenous repository

Using the command line

Initial setup:

  • From the repository's root directory type: cmake CMakeLists.txt

To run each assignment:

  • To compile an assignment, type: make mp<N>, where <N> is that assignment's number
  • For example, to compile the MP2 assignment type: make mp2
  • To run an assignment, type: ./mp<N> tests/mp<N>/<D>/*, where <N> is a homework number and <D> is a data set number
  • For example, to execute assignment MP2 on data set 0 type: ./mp2 tests/mp2/0/*

You can also test each assignment against the official datasets using CMake's ctest:

  • To run all of the MP assignments against the official datasets, from the repository's root directory, type: ctest -V
  • To run a specific MP assignment, for example MP2, type ctest -L mp2 -V

You can view all of the information presented during the testing phase in the folder Testing/Temporary/LastTest.log

Contributors ============ ***

View list of contributors

We welcome improvements to this code. Simply fork it, make your change, and initiate a pull request! (Please follow the coding conventions already in use in the source files).

License


All the files in this project are shared under the MIT License.

Copyright (C) 2012 Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

coursera-heterogeneous's People

Contributors

andre-orr avatar ashwin avatar daferna avatar gregbowyer avatar haotian-wang avatar iemejia avatar mehaase avatar mikebern avatar profbbrown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coursera-heterogeneous's Issues

Error on MP4 DS1.

I think my solution for MP4 is correct. It runs correctly on the Coursera site. DS0 and DS2-5 run correctly locally. But I am getting the wrong answer when I run DS1 locally:

Solution does not match at item 0. Expecting 1029.6700439453 but got 1029.6650390625.

As you can see, my answer is about .005004 away from the expected answer. I looked at the solution checker and it looks for solutions that are within .005.

Is anybody else having this problem? I believe that the checker on the Coursera site is rounding to two decimal places before checking.

POSIX timers on Fedora 17

Hi.

On Fedora 17 it is necessary to link against rt library or else linker will fail:

/usr/bin/ld: CMakeFiles/mp1.dir/src/./mp1_generated_mp1.cu.o: undefined reference to symbol 'clock_gettime@@GLIBC_2.2.5'
/usr/bin/ld: note: 'clock_gettime@@GLIBC_2.2.5' is defined in DSO /lib64/librt.so.1 so try adding it to the linker command line
/lib64/librt.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

Currently it's enough to just add following line to CMakeLists.txt

target_link_libraries(mp1 rt)

because only mp1 use time functions.

ctest

Hi,
first of all thank you very much for this repository, it's been very useful to test the MPs of the course.
I think that there may be a bug in the CMakeLists.txt, in the test section. When i run (eg for mp5)
ctest -L mp5 -V .
my mp runs ok and give the correct results but the testing framework does not recognize that as it cannot find the string "All test passed" (eg. see line 109 of CMakeLists) and so it gives that all the tests have failed.
So i guess the string should either changed to "The solution is correct" which is actually the string print by all MPs when everything goes ok, or change the function in include/wb.h so that the string "All test passed" is actually printed at the end of the comparison with the expected output.
I quickly tried the first option (change the CMakeLists) and it works.

Thank you!

S.

problems compiling in Mac OS X mp1..mp3

I downloaded the coursera-heterogeneous from github
I followed the instructions to compile in Mac OS X.
I build the mp0 sucessfully but for the others I have the following error

clang: error: unsupported option '-dumpspecs'
clang: error: no input files
CMake Error at mp1_generated_mp1.cu.o.cmake:206 (message):
Error generating
/Users/jlopes/Documents/Coursera/coursera-heterogeneous/CMakeFiles/mp1.dir/src/Debug/mp1_generated_mp1.cu.o
make: *** [/Users/jlopes/Documents/Coursera/coursera-heterogeneous/CMakeFiles/mp1.dir/src/Debug/mp1_generated_mp1.cu.o] Error 1

I also tried to use the "Unix command line" approach
The cmake step ran sucessfully
The make mp0 compiled without problems
The compilation of the others assignments gave the same error related with clang and the unsupported option "-dumpspecs"

Cheers
João

Mac instructions are incomplete

Thanks for creating this! I'm looking forward to getting it working. I noticed the Mac instructions are incomplete, it says:

"Select mp0 under targets"

If you do this, then only mp0 will build correctly. mp1 and mp2 will get linker errors. I added it to m1, mp2, and mp3, but I think you can also add it to "ALL BUILD". (I have no idea if that would actually work... I hate XCode and almost never use it.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.