Unified Parallel C
1 program
Added 2026-02-26T10:00:00Z
Agent: claude-codeModel: claude-sonnet-4-6WebSearch: enabled
Evidence
Report issue
View issues
Aliases: UPC
Provenance: commit 1be72ca9c6 · authored 2026-02-26T22:38:01+01:00 · agent claude-code · model claude-sonnet-4-6
Sources mentioning this language
6 sources · pl_id:
pl/unified-parallel-cWikipedia infobox ↗
Pulled from the
wikimedia/structured-wikipedia
snapshot — see data/raw/wikipedia_pl_facts.*.jsonl and
pl_fact.csv for the long-table provenance.
| Paradigms | parallel · message passing · imperative (procedural) · structured |
|---|---|
| Typing | static, weak, manifest |
| Designed by | UPC Consortium |
| Influenced by | C · AC · Split-C · Parallel C Preprocessor |
| Homepage | http://upc-lang.org |
Extensions claimed by this language
1 claim. Each row is one upstream assertion with its strength.
SWH column shows file occurrences with that extension across the entire archive.| Extension | Source | Strength | SWH |
|---|---|---|---|
.upc | linguist | primary | 8.7K files |
Related languages
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)
Programs collected by LLM agents experimental · unverified
Gathered by LLM agents during the experiment that started this catalogue. They are not verified: the agent names an origin, but a program can be altered or invented — an audit found one attributed to a file that does not exist, in a syntax the language does not have. Prefer the programs archived by Software Heritage above. The catalogue's goal is the languages themselves, grounded in sources (PLDB, Wikipedia, Rosetta Code, …), with real archived programs; these examples may be dropped.
Monte Carlo Pi Estimation
Provenance: commit 1be72ca9c6 · authored 2026-02-26T22:38:01+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch enabled
// Compute pi by approximating the area of a circle of radius 1.
// Algorithm: generate random points in [0,1]x[0,1] and measure the fraction
// of them falling in a circle centered at the origin (approximates pi/4)
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <upc.h>
int hit() { // return non-zero for a hit in the circle
double x = rand()/(double)RAND_MAX;
double y = rand()/(double)RAND_MAX;
return (x*x + y*y) <= 1.0;
}
// shared array for the results computed by each thread
shared int64_t all_hits[THREADS];
int main(int argc, char **argv) {
int64_t trials = 100000000;
if (argc > 1) trials = (int64_t)atoll(argv[1]);
int64_t my_trials = (trials + THREADS - 1 - MYTHREAD)/THREADS;
srand(MYTHREAD); // seed each thread's PRNG differently
int64_t my_hits = 0;
for (int64_t i=0; i < my_trials; i++)
my_hits += hit(); // compute in parallel
all_hits[MYTHREAD] = my_hits; // publish results
upc_barrier;
if (MYTHREAD == 0) { // fetch results from each thread
// (could alternatively call upc_all_reduce())
int64_t total_hits = 0;
for (int i=0; i < THREADS; i++)
total_hits += all_hits[i];
double pi = 4.0*total_hits/(double)trials;
printf("PI estimated to %10.7f from %lld trials on %d threads.\n",
pi, (long long)trials, THREADS);
}
return 0;
}