{"id":23499926,"url":"https://github.com/dhruvsrikanth/cudann","last_synced_at":"2026-05-01T00:31:39.325Z","repository":{"id":111259347,"uuid":"577424591","full_name":"DhruvSrikanth/CUDANN","owner":"DhruvSrikanth","description":"A distributed implementation of a deep learning framework in CUDA.","archived":false,"fork":false,"pushed_at":"2023-01-06T03:46:43.000Z","size":190,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-29T20:12:45.479Z","etag":null,"topics":["cpp","cuda","deep-learning","deep-learning-framework","gpu-programming","high-performance-computing","hpc","parallel-programming"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DhruvSrikanth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-12T17:52:58.000Z","updated_at":"2023-12-11T19:27:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"196871f3-137b-4247-ab37-26dbd08cebee","html_url":"https://github.com/DhruvSrikanth/CUDANN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DhruvSrikanth/CUDANN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvSrikanth%2FCUDANN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvSrikanth%2FCUDANN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvSrikanth%2FCUDANN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvSrikanth%2FCUDANN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DhruvSrikanth","download_url":"https://codeload.github.com/DhruvSrikanth/CUDANN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvSrikanth%2FCUDANN/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32481553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cuda","deep-learning","deep-learning-framework","gpu-programming","high-performance-computing","hpc","parallel-programming"],"created_at":"2024-12-25T06:33:11.513Z","updated_at":"2026-05-01T00:31:39.258Z","avatar_url":"https://github.com/DhruvSrikanth.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CUDANN\nA distributed implementation of a deep learning framework in CUDA.\n\n# Serial Implementation\n\nThis can be tested using the following command - \n\n```shell\nmake test_random\n```\n\nThe above command runs the following example of using the framework - \n\n```c++\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n#include \u003cstring.h\u003e\n#include \u003ciostream\u003e\n#include \u003cctime\u003e\n#include \u003ctime.h\u003e \n#include \u003cunordered_map\u003e\n\n#include \"../serial/cudann.h\"\n\n\nstruct MiniBatch {\n    Tensor *input;\n    Tensor *target;\n};\n\nstruct Dataloader {\n    MiniBatch *minibatches;\n    int n_batches;\n};\n\n\nvoid train(const int n_classes, const int n_features, const double learning_rate, const int epochs, Dataloader *dataloader, NN *model, CrossEntropy *criterion) {\n    // Print model summary\n    model-\u003esummary();\n\n    printf(\"Loss function: \");\n    criterion-\u003eshow();\n\n    printf(\"Training model for %d epochs with learning rate %f.\\n\", epochs, learning_rate);\n    // Train the model\n    for (int epoch = 0; epoch \u003c epochs; epoch++) {\n        // Compute average loss over a batch\n        double avg_loss = 0.0;\n        for (int mb = 0; mb \u003c dataloader-\u003en_batches; mb++) {\n            // Get minibatch and copy it to the appropriate device\n            Tensor *input = (Tensor*) malloc(sizeof(Tensor));\n            Tensor *target = (Tensor*) malloc(sizeof(Tensor));\n            copy_tensor(input, dataloader-\u003eminibatches[mb].input);\n            copy_tensor(target, dataloader-\u003eminibatches[mb].target);\n\n            // Forward pass\n            Tensor *output = model-\u003eforward(input);\n\n            // Compute loss\n            Tensor *loss = criterion-\u003eforward(output, target);\n            \n            // Compute the loss gradient\n            Tensor *downstream_grad = criterion-\u003ebackward();\n\n            // Backward pass\n            model-\u003ebackward(downstream_grad);\n\n            // Update weights\n            model-\u003eupdate_weights(learning_rate);\n\n            // Compute average loss\n            avg_loss += loss-\u003esum() / loss-\u003ebatch_size;\n        }\n        avg_loss /= dataloader-\u003en_batches;\n        \n        printf(\"Epoch %d: Average loss: %f\\n\", epoch + 1, avg_loss);\n    }\n}\n\nint main(int argc, char *argv[]) {\n    const int n_classes = 10;\n    const int n_features = 28*28;\n    const int batch_size = 64;\n    const double learning_rate = 0.01;\n    const int n_batches = 1000;\n    const int epochs = 10;\n\n    // Add layers\n    Linear linear1(n_features, 128, true, \"random\", \"linear1\");\n    ReLU relu1(128, \"relu1\");\n    Linear linear2(128, n_classes, true, \"random\", \"linear2\");\n    Softmax softmax(n_classes, \"softmax\");\n\n    // Create model and add layers\n    NN model;\n    model.add_layer(\u0026linear1);\n    model.add_layer(\u0026relu1);\n    model.add_layer(\u0026linear2);\n    model.add_layer(\u0026softmax);\n\n    // Get loss function\n    CrossEntropy criterion(\"cross_entropy\");\n\n    // Create dataloader\n    Dataloader dataloader;\n    dataloader.n_batches = n_batches;\n    dataloader.minibatches = (MiniBatch*) malloc(n_batches*sizeof(MiniBatch));\n    for (int i = 0; i \u003c n_batches; i++) {\n        // Create random input tensor\n        double *data = (double*) malloc(batch_size*n_features*sizeof(double));\n        initialize_random(data, batch_size*n_features);\n        Tensor input(batch_size, n_features, data);\n\n        // Create the random target tensor\n        double *target_data = (double*) malloc(batch_size*n_classes*sizeof(double));\n        initialize_salt_and_pepper(target_data, batch_size*n_classes);\n        Tensor target(batch_size, n_classes, target_data);\n\n        // Create minibatch\n        MiniBatch minibatch;\n        minibatch.input = (Tensor*) malloc(sizeof(Tensor));\n        minibatch.target = (Tensor*) malloc(sizeof(Tensor));\n        copy_tensor(minibatch.input, \u0026input);\n        copy_tensor(minibatch.target, \u0026target);\n\n        // Add minibatch to dataloader\n        dataloader.minibatches[i] = minibatch;\n    }\n\n    // Train the model\n    train(n_classes, n_features, learning_rate, epochs, \u0026dataloader, \u0026model, \u0026criterion);\n\n    \n    return 0;\n}\n\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruvsrikanth%2Fcudann","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhruvsrikanth%2Fcudann","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruvsrikanth%2Fcudann/lists"}