initial code

This commit is contained in:
Osman Faruk Bayram 2024-12-10 19:00:20 +03:00
commit c04da58ea3
3 changed files with 58 additions and 0 deletions

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1733686850,
"narHash": "sha256-NQEO/nZWWGTGlkBWtCs/1iF1yl2lmQ1oY/8YZrumn3I=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "dd51f52372a20a93c219e8216fe528a648ffcbf4",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

15
flake.nix Normal file
View file

@ -0,0 +1,15 @@
{
description = "cuda kernel compilation with nix";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }: {
packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;
packages.x86_64-linux.default = self.packages.x86_64-linux.hello;
};
}

16
main.cu Normal file
View file

@ -0,0 +1,16 @@
#include <iostream>
int main()
{
int run_version, driver_version;
std::cout<< "Return Code Runtime Version: ";
std::cout<<cudaRuntimeGetVersion(&run_version);
std::cout<<"\nReturn Code Driver Version: ";
std::cout<<cudaDriverGetVersion(&driver_version);
std::cout << "\nRuntime Version: ";
std::cout << run_version;
std::cout << "\n Driver Version: ";
std::cout << driver_version;
return 0;
}