mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge branch 'LCTT:master' into master
This commit is contained in:
commit
e49c0fc46d
@ -3,80 +3,67 @@
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "hanszhao80"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14563-1.html"
|
||||
|
||||
在 2022 年学习 Rust
|
||||
2022 Rust 入门指南
|
||||
======
|
||||
如果你打算在今年探索 Rust,请下载我们的免费 Rust 速查表,以供快速参考基础知识。
|
||||
![Cheat Sheet cover image][1]
|
||||
|
||||
Rust 是一门相对较新的编程语言,受到各个企业的 [程序员的欢迎][2]。尽管如此,它仍是一门建立在之前所有事物之上的语言。毕竟,Rust 不是一天做出来的,所以即便 Rust 中的一些概念看起来与你从 Python、Java、C++ 等编程语言学到的东西大不相同,但它们都是在同一个 CPU 和你一直交互使用(无论你是否知道)的 <ruby>非一致性内存访问<rt>NUMA</rt></ruby> 架构上打下的基础,因此 Rust 中的一些新功能让人感觉有些熟悉。
|
||||
> 如果你打算在今年探索 Rust,请下载我们的免费 Rust 速查表,以供快速参考基础知识。
|
||||
|
||||
现在,我的职业不是程序员。我没耐心但我又有点儿强迫症。当我需要完成某件事时,如果一门语言不能帮助相对较快地获得我想要的结果,那么我很少会受到鼓舞而使用它。Rust 试图平衡两个矛盾:现代计算机对安全和结构化代码的需求和现代程序员对编码工作事半功倍的渴望。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202205/08/161625lvo8v82ell9l3xmm.jpg)
|
||||
|
||||
Rust 是一门相对较新的编程语言,受到各个企业的 [程序员的欢迎][2]。尽管如此,它仍是一门建立在之前所有事物之上的语言。毕竟,Rust 不是一天做出来的,所以即便 Rust 中的一些概念看起来与你从 Python、Java、C++ 等编程语言学到的东西大不相同,但它们都是基于同一个基础,那就是你一直与之交互(无论你是否知道)的 CPU 和 NUMA(<ruby>非统一内存访问<rt>Non Uniform Memory Access</rt></ruby>)架构,因此 Rust 中的一些新功能让人感觉有些熟悉。
|
||||
|
||||
现在,我的职业不是程序员。我没耐心但我又有点儿强迫症。当我需要完成某件事时,如果一门语言不能帮助我相对较快地获得想要的结果,那么我很少会受到鼓舞而使用它。Rust 试图平衡两个矛盾:现代计算机对安全和结构化代码的需求,和现代程序员对编码工作事半功倍的渴望。
|
||||
|
||||
### 安装 Rust
|
||||
|
||||
[rust-lang.org][3] 网站有丰富的的文档指导如何安装 Rust,但通常,它就像下载 `sh.rustup.rs` 脚本并运行它一样简单。
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ curl --proto '=https' --tlsv1.2 -sSf <https://sh.rustup.rs>
|
||||
|
||||
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
|
||||
$ less sh.rustup.sh
|
||||
|
||||
$ sh ./sh.rustup.rs
|
||||
|
||||
```
|
||||
|
||||
### 没有类
|
||||
|
||||
Rust 没有类,也不使用 `class` 关键字。Rust 确实有 `struct` 数据类型,但它的作用是充当数据集合的一种模板。因此,你可以使用<ruby>结构体<rt>struct</rt></ruby>,而不是创建一个类来表示虚拟对象:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
struct Penguin {
|
||||
genus: String,
|
||||
species: String,
|
||||
extinct: bool,
|
||||
classified: u64,
|
||||
genus: String,
|
||||
species: String,
|
||||
extinct: bool,
|
||||
classified: u64,
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
你可以像使用类一样使用它。例如,当定义完 `Penguin` 结构,你就可以创建它的实例,并与该实例进行交互:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
struct Penguin {
|
||||
genus: String,
|
||||
species: String,
|
||||
extinct: bool,
|
||||
classified: u64,
|
||||
genus: String,
|
||||
species: String,
|
||||
extinct: bool,
|
||||
classified: u64,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let p = Penguin { genus: "Pygoscelis".to_owned(),
|
||||
species: "R adeliæ".to_owned(),
|
||||
extinct: false,
|
||||
classified: 1841 };
|
||||
let p = Penguin { genus: "Pygoscelis".to_owned(),
|
||||
species: "R adeliæ".to_owned(),
|
||||
extinct: false,
|
||||
classified: 1841 };
|
||||
|
||||
println!("Species: {}", p.species);
|
||||
println!("Genus: {}", p.genus);
|
||||
println!("Classified in {}", p.classified);
|
||||
if p.extinct == true {
|
||||
println!("Sadly this penguin has been made extinct.");
|
||||
}
|
||||
|
||||
println!("Species: {}", p.species);
|
||||
println!("Genus: {}", p.genus);
|
||||
println!("Classified in {}", p.classified);
|
||||
if p.extinct == true {
|
||||
println!("Sadly this penguin has been made extinct.");
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
将 `impl` 数据类型与 `struct` 数据类型结合使用,你可以实现一个包含函数的结构体,并且可以添加继承和其他与类相似的特性。
|
||||
@ -87,23 +74,16 @@ Rust 中的函数很像其他语言中的函数。每个函数都代表一组严
|
||||
|
||||
用 `fn` 关键字声明函数,后跟函数名称和函数接受的所有参数。
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
fn foo() {
|
||||
let n = 8;
|
||||
println!("Eight is written as {}", n);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
通过参数,将信息从一个函数传递到另一个函数。例如,我已经创建了一个 `Penguin` 类,并且我有一个 `Penguin` 的实例为 `p`,将目标函数的参数指定为 `Penguin`类型,就可把 `p` 的属性从一个函数传递到另一个函数。
|
||||
|
||||
通过参数,将信息从一个函数传递到另一个函数。例如,我已经创建了一个 `Penguin` 类(结构),并且我有一个 `Penguin` 的实例为 `p`,将目标函数的参数指定为 `Penguin` 类型,就可把 `p` 的属性从一个函数传递到另一个函数。
|
||||
|
||||
```
|
||||
|
||||
|
||||
fn main() {
|
||||
let p = Penguin { genus: "Pygoscelis".to_owned(),
|
||||
species: "R adeliæ".to_owned(),
|
||||
@ -116,169 +96,134 @@ fn printer(p: Penguin) {
|
||||
println!("Genus: {}", p.genus);
|
||||
println!("Classified in {}", p.classified);
|
||||
if p.extinct == true {
|
||||
println!("Sadly this penguin has been made extinct.");
|
||||
println!("Sadly this penguin has been made extinct.");
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### 变量
|
||||
|
||||
Rust 默认创建的为<ruby>不可变<rt>immutable</rt></ruby>变量。这意味着你创建的变量以后无法更改。这段代码虽然看起来没问题,但无法编译:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
fn main() {
|
||||
let n = 6;
|
||||
let n = 5;
|
||||
}
|
||||
|
||||
let n = 6;
|
||||
let n = 5;
|
||||
}
|
||||
```
|
||||
|
||||
但你可以使用关键字 `mut` 声明一个<ruby>可变<rt>mutable</rt></ruby>变量,因此下面这段代码可以编译成功:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
fn main() {
|
||||
let mut n = 6;
|
||||
println!("Value is {}", n);
|
||||
n = 5;
|
||||
println!("Value is {}", n);
|
||||
let mut n = 6;
|
||||
println!("Value is {}", n);
|
||||
n = 5;
|
||||
println!("Value is {}", n);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### 编译
|
||||
|
||||
Rust 编译器,至少就其报错信息而言,是可用的最好的编译器之一。当你在 Rust 中出错时,编译器会真诚地告诉你做错了什么。实际上,仅通过从编译器错误消息中学习,我就了解了 Rust 的许多细微差别(就我理解到的 Rust 的任何细微差别而言)。即便有时错误消息太过于模糊,而不知所以然,互联网搜索几乎总能得到解释。
|
||||
|
||||
启动 Rust 程序的最简单方法是使用 `cargo`,即 Rust 包管理和构建系统。
|
||||
|
||||
启动 Rust 程序的最简单方法是使用 `cargo`,它是 Rust 的包管理和构建系统。
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ mkdir myproject
|
||||
$ cd myproject
|
||||
$ cargo init
|
||||
|
||||
```
|
||||
|
||||
以上命令为项目创建了基本的基础架构,最值得注意的是 `src` 子目录中的 `main.rs` 文件。打开此文件,把我为本文生成的示例代码粘贴进去:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
struct Penguin {
|
||||
genus: String,
|
||||
species: String,
|
||||
extinct: bool,
|
||||
classified: u64,
|
||||
genus: String,
|
||||
species: String,
|
||||
extinct: bool,
|
||||
classified: u64,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let p = Penguin { genus: "Pygoscelis".to_owned(), species: "R adeliæ".to_owned(), extinct: false, classified: 1841 };
|
||||
printer(p);
|
||||
foo();
|
||||
let p = Penguin { genus: "Pygoscelis".to_owned(), species: "R adeliæ".to_owned(), extinct: false, classified: 1841 };
|
||||
printer(p);
|
||||
foo();
|
||||
}
|
||||
|
||||
fn printer(p: Penguin) {
|
||||
println!("Species: {}", p.species);
|
||||
println!("Genus: {}", p.genus);
|
||||
println!("Classified in {}", p.classified);
|
||||
if p.extinct == true {
|
||||
println!("Sadly this penguin has been made extinct.");
|
||||
}
|
||||
println!("Species: {}", p.species);
|
||||
println!("Genus: {}", p.genus);
|
||||
println!("Classified in {}", p.classified);
|
||||
if p.extinct == true {
|
||||
println!("Sadly this penguin has been made extinct.");
|
||||
}
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
let mut n = 6;
|
||||
println!("Value is {}", n);
|
||||
n = 8;
|
||||
let mut n = 6;
|
||||
println!("Value is {}", n);
|
||||
n = 8;
|
||||
println!("Eight is written as {}", n);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
使用 `cargo build` 命令进行编译:
|
||||
|
||||
|
||||
```
|
||||
$ cargo build
|
||||
```
|
||||
|
||||
执行 `target` 子目录下的二进制程序,或者直接运行 `cargo run` 命令来运行你的项目:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ cargo run
|
||||
Species: R adeliæ
|
||||
Genus: Pygoscelis
|
||||
Classified in 1841
|
||||
Value is 6
|
||||
Eight is written as 8
|
||||
|
||||
```
|
||||
|
||||
### Crates
|
||||
|
||||
任何语言的大部分便利都来自于它的库或模块。在 Rust 中,进行分发和跟踪的库称为 `crate`。 [crates.io][4] 是一个很好的社区 `crate` 注册网站。
|
||||
|
||||
把一个 `crate` 添加到你的 Rust 项目,首先要在 `Cargo.toml` 文件中添加这个 `crate`。 例如,要安装随机数函数,我使用名为 `rand` 的 `crate`,使用 `*` 作为通配符,以确保在编译时获得最新版本:
|
||||
任何语言的大部分便利都来自于它的库或模块。在 Rust 中,进行分发和跟踪的库称为 “crate”(箱子)。[crates.io][4] 是一个很好的社区 crate 注册网站。
|
||||
|
||||
把一个 crate 添加到你的 Rust 项目,首先要在 `Cargo.toml` 文件中添加这个 crate。例如,要安装随机数函数,我使用名为 `rand` 的 crate,使用 `*` 作为通配符,以确保在编译时获得最新版本:
|
||||
|
||||
```
|
||||
|
||||
|
||||
[package]
|
||||
name = "myproject"
|
||||
version = "0.1.0"
|
||||
authors = ["Seth <[seth@opensource.com][5]>"]
|
||||
authors = ["Seth <seth@opensource.com>"]
|
||||
edition = "2022"
|
||||
|
||||
[dependencies]
|
||||
rand = "*"
|
||||
|
||||
```
|
||||
|
||||
在 Rust 代码中使用它需要在最顶行使用 `use` 语句:
|
||||
|
||||
|
||||
|
||||
```
|
||||
use rand::Rng;
|
||||
```
|
||||
|
||||
以下是一些创建随机种子和随机范围的示例代码:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
fn foo() {
|
||||
let mut rng = rand::thread_rng();
|
||||
let mut n = rng.gen_range(1..99);
|
||||
let mut rng = rand::thread_rng();
|
||||
let mut n = rng.gen_range(1..99);
|
||||
|
||||
println!("Value is {}", n);
|
||||
n = rng.gen_range(1..99);
|
||||
println!("Value is {}", n);
|
||||
println!("Value is {}", n);
|
||||
n = rng.gen_range(1..99);
|
||||
println!("Value is {}", n);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
你可以使用 `cargo run` 来运行它,它会检测代码是否被更改并触发一个新的构建。构建过程中下载名为 `rand` 的 `crete` 和它依赖的所有 `crate`,编译代码,然后运行它:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ cargo run
|
||||
Updating crates.io index
|
||||
Downloaded ppv-lite86 v0.2.16
|
||||
@ -299,14 +244,15 @@ Genus: Pygoscelis
|
||||
Classified in 1841
|
||||
Value is 70
|
||||
Value is 35
|
||||
|
||||
```
|
||||
|
||||
### Rust 速查表
|
||||
|
||||
Rust 是一门令人非常愉快的语言。它拥有在线注册网站的集成、有用的编译器和几乎直观的语法,给人的感觉非常现代。
|
||||
Rust 是一门令人非常愉快的语言。集成了在线注册网站、有用的编译器和几乎直观的语法,它给人的适当的现代感。
|
||||
|
||||
但请不要误会,Rust 仍是一门复杂的语言,它具有严格的数据类型、强作用域变量和许多内置方法。Rust 值得一看,如果你要探索它,那么你应该下载我们的免费 **[Rust 速查表][6]**,以便快速了解基础知识。越早开始,就越早了解 Rust。当然,你应该经常练习以避免生疏。
|
||||
但请不要误会,Rust 仍是一门复杂的语言,它具有严格的数据类型、强作用域变量和许多内置方法。Rust 值得一看,如果你要探索它,那么你应该下载我们的免费 [Rust 速查表][6],以便快速了解基础知识。越早开始,就越早了解 Rust。当然,你应该经常练习以避免生疏。
|
||||
|
||||
> **[Rust 速查表][6]**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -315,7 +261,7 @@ via: https://opensource.com/article/22/1/rust-cheat-sheet
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[hanszhao80](https://github.com/hanszhao80)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,45 +0,0 @@
|
||||
zxcv545 is translating
|
||||
|
||||
[#]: subject: "Nvidia Begins To Set The Foundation For Future Open And Parallel Coding"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/05/nvidia-begins-to-set-the-foundation-for-future-open-and-parallel-coding/"
|
||||
[#]: author: "Laveesh Kocher https://www.opensourceforu.com/author/laveesh-kocher/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Nvidia Begins To Set The Foundation For Future Open And Parallel Coding
|
||||
======
|
||||
![Nvidia_logo_angled_shutterstock][1]
|
||||
|
||||
As graphics processors become more common in computers, Nvidia is expanding its collaboration with standards and open source communities to include downstream technologies that were previously limited to the company’s development tools. A lot of effort is being put into programming languages like C++ and Fortran, which are thought to lag behind native implementation when it comes to executing code on highly parallel computers.
|
||||
|
||||
Nvidia’s CUDA parallel programming framework, which combines open and proprietary libraries, is responsible for many of the technologies being opened up and mainstreamed. In 2007, CUDA was introduced as a set of programming tools and frameworks for programmers to develop GPU-based systems. However, as GPU utilisation grew in more applications and sectors, the CUDA philosophy shifted.
|
||||
|
||||
Nvidia is best recognised for its GPU dominance, but CUDA is at the heart of the company’s rebranding as a software and services supplier targeting a $1 trillion market cap. Nvidia’s long-term ambition is to become a full-stack provider with a focus on specific fields such as autonomous driving, quantum computing, health care, robotics, cybersecurity, and quantum computing.
|
||||
|
||||
Nvidia has created dedicated CUDA libraries in certain domains, as well as the hardware and services that businesses can use. The concept of a “AI factory,” announced by CEO Jensen Huang at the recent GPU Technology Conference, best exemplifies the full-stack strategy. Customers can drop applications into Nvidia’s mega datacenters, with the result being a customised AI model tailored to specific industry or application needs.
|
||||
|
||||
Nvidia may profit from AI factory principles in two ways: by utilising GPU capacity or by utilising domain-specific CUDA libraries. On Nvidia GPUs, programmers can use open source parallel programming frameworks such as OpenCL. CUDA, on the other hand, will deliver that extra last-mile increase for those willing to invest because it is tuned to operate closely with Nvidia’s GPU.
|
||||
|
||||
While parallel programming is common in high-performance computing, Nvidia’s goal is to make it a norm in mainstream computing. The company is assisting in the standardisation of best-in-class tools for writing parallel code that is portable across hardware platforms regardless of brand, accelerator type, or parallel programming framework.
|
||||
|
||||
For one thing, Nvidia is a member of a C++ group that is building the groundwork for simultaneous execution of portable code across hardware. A context could be a CPU thread that primarily performs IO or a CPU or GPU thread that does demanding computation. Nvidia is particularly engaged in delivering C++ programmers a standard language and infrastructure for asynchrony and parallelism.
|
||||
|
||||
The first work focused on the memory model, which was incorporated in C++ 11, but had to be updated when parallelism and concurrency became more prevalent. C++ 11’s memory model emphasised concurrent execution across multicore CPUs, but it lacked parallel programming hooks. The C++ 17 standard laid the foundation for higher-level parallelism features, but real portability will have to wait for future standards. C++ 20 is the current standard, with C++ 23 on the horizon.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/05/nvidia-begins-to-set-the-foundation-for-future-open-and-parallel-coding/
|
||||
|
||||
作者:[Laveesh Kocher][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/laveesh-kocher/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/05/Nvidia_logo_angled_shutterstock.jpg
|
@ -0,0 +1,84 @@
|
||||
[#]: subject: "How open source leads the way for sustainable technology"
|
||||
[#]: via: "https://opensource.com/article/22/5/open-source-sustainable-technology"
|
||||
[#]: author: "Hannah Smith https://opensource.com/users/hanopcan"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How open source leads the way for sustainable technology
|
||||
======
|
||||
There are huge parallels between the open source way and what our wider society needs to do to achieve a more sustainable future.
|
||||
|
||||
![][1]
|
||||
(Image by: opensource.com)
|
||||
|
||||
There's a palpable change in the air regarding sustainability and environmental issues. Concern for the condition of the planet and efforts to do something about it have gone mainstream. To take one example, look at climate-based venture capitalism. The Climate Tech Venture Capital (CTVC) Climate Capital List has [more than doubled][2] in the past two years. The amount of capital pouring in demonstrates a desire and a willingness to solve hard climate challenges.
|
||||
|
||||
It's great that people want to take action, and I'm here for it! But I also see a real risk: As people rush to take action or jump on the bandwagon, they may unwittingly participate in greenwashing.
|
||||
|
||||
The Wikipedia definition of greenwashing calls it "a form of marketing spin in which green PR and green marketing are deceptively used to persuade the public that an organization's products, aims, and policies are environmentally friendly." In my view, greenwashing happens both intentionally and accidentally. There are a lot of good people out there who want to make a difference but don't yet know much about complex environmental systems or the depth of issues around sustainability.
|
||||
|
||||
It's easy to fall into the trap of thinking a simple purchase like offsetting travel or datacenter emissions by planting trees will make something greener. While these efforts are welcome, and planting trees is a viable solution to improving sustainability, they are only a good first step—a scratch on the surface of what needs to happen to make a real difference.
|
||||
|
||||
So what can a person, or a community, do to make digital technology genuinely more sustainable?
|
||||
|
||||
Sustainability has different meanings to different people. The shortest definition that I like is from the 1987 Bruntland Report, which summarizes it as "meeting the needs of the present without compromising the ability of future generations to meet their needs." Sustainability at its core is prioritizing long-term thinking.
|
||||
|
||||
### Sustainability is more than environmental preservation
|
||||
|
||||
There are three key interconnected pillars in the definition of sustainability:
|
||||
|
||||
1. Environmental
|
||||
2. Economic / governance
|
||||
3. Social
|
||||
|
||||
Conversations about sustainability are increasingly dominated by the climate crisis—for good reason. The need to reduce the amount of carbon emissions emitted by the richer countries in the world becomes increasingly urgent as we continue to pass irreversible ecological tipping points. But true sustainability is a much more comprehensive set of considerations, as demonstrated by the three pillars.
|
||||
|
||||
Carbon emissions are most certainly a part of sustainability. Many people consider emissions only an environmental issue: Just take more carbon out of the air, and everything will be ok. But social issues are just as much a part of sustainability. Who is affected by these carbon emissions? Who stands to bear the greatest impact from changes to our climate? Who has lost their land due to rising sea levels or a reliable water source due to changing weather patterns? That's why you might have heard the phrase "climate justice is social justice."
|
||||
|
||||
Thinking only about decarbonization as sustainability can give you carbon tunnel vision. I often think that climate change is a symptom of society getting sustainability wrong on a wider scale. Instead, it is critical to address the root causes that brought about climate change in the first place. Tackling these will make it possible to fix the problems in the long term, while a short-term fix may only push the issue onto another vulnerable community.
|
||||
|
||||
The root causes are complex. But if I follow them back to their source, I see that the root causes are driven by dominant Western values and the systems designed to perpetuate those values. And what are those values? For the most part, they are short-term growth and the extraction of profit above all else.
|
||||
|
||||
That is why conversations about sustainability that don't include social issues or how economies are designed won't reach true solutions. After all, societies, and the people in positions of power, determine what their own values are—or aren't.
|
||||
|
||||
### What can you or I do?
|
||||
|
||||
Many in the tech sector are currently grappling with these issues and want to know how to take meaningful action. One common approach is looking at how to optimize the tech they build so that it uses electricity more effectively. Sixty percent of the world's electricity is still generated by burning fossil fuels, despite the increasing capacity for renewable energy generation. Logically, using less electricity means generating fewer carbon emissions.
|
||||
|
||||
And yes, that is a meaningful action that anyone can take right now, today. Optimizing the assets sent when someone loads a page to send less data will use less energy. So will optimizing servers to run at different times of the day, for example when there are more renewables online, or deleting old stores of redundant information, such as analytics data or logs.
|
||||
|
||||
But consider Jevon's paradox: Making something more efficient often leads to using more of it, not less. When it is easier and more accessible for people to use something, they end up consuming more. In some ways, that is good. Better performing tech is a good thing that helps increase inclusion and accessibility, and that's good for society. But long-term solutions for climate change and sustainability require deeper, more uncomfortable conversations around the relationship between society and technology. What and who is all this technology serving? What behaviors and practices is it accelerating?
|
||||
|
||||
It's common to view advancing technology as progress, and some people repeat the mantra that technology will save the world from climate change. A few bright folks will do the hard work, so no one else has to change their ways. The problem is that many communities and ecosystems are already suffering.
|
||||
|
||||
For example, the accelerating quest for more data is causing some communities in Chile to have insufficient water to grow their crops. Instead, datacenters are using it. Seventy percent of the pollution caused by mobile phones comes from their manufacture. The raw resources such as lithium and cobalt to make and power mobile devices are usually extracted from a community that has little power to stop the destruction of their land and that certainly does not partake in the profit made. Still, the practice of upgrading your phone every two years has become commonplace.
|
||||
|
||||
### Open source leading the way for sustainability
|
||||
|
||||
It's time to view the use of digital technology as a precious resource with consequences to both the planet and (often already disadvantaged) communities.
|
||||
|
||||
The open source community is already a leading light in helping people to realize there is another way: the open source way. There are huge parallels between the open source way and what our wider society needs to do to achieve a more sustainable future. Being more open and inclusive is a key part of that.
|
||||
|
||||
We also need a mindset shift at all levels of society that views digital technology as having growth limits and not as the abundantly cheap and free thing we see today. We need to wisely prioritize its application in society to the things that matter. And above all else, we need to visualize and eradicate the harms from its creation and continued use and share the wealth that is does create equitably with everyone in society, whether they are users of digital tech or not. These things aren’t going to happen overnight, but they are things we can come together to push towards so that we all enjoy the benefits of digital technology for the long-term, sustainably.
|
||||
|
||||
This article is based on a longer presentation. To see the talk in full or view the slides, see the post ["How can we make digital technology more sustainable."][3]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/5/open-source-sustainable-technology
|
||||
|
||||
作者:[Hannah Smith][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/hanopcan
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/pictures/green-780x400.jpg
|
||||
[2]: https://climatetechvc.substack.com/p/-a-running-list-of-climate-tech-vcs?s=w
|
||||
[3]: https://opcan.co.uk/talk/wordfest-live-2022
|
@ -0,0 +1,44 @@
|
||||
|
||||
[#]: subject: "Nvidia Begins To Set The Foundation For Future Open And Parallel Coding"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/05/nvidia-begins-to-set-the-foundation-for-future-open-and-parallel-coding/"
|
||||
[#]: author: "Laveesh Kocher https://www.opensourceforu.com/author/laveesh-kocher/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Nvidia 开始着手为未来的开放和并行编程建立基础。
|
||||
======
|
||||
![Nvidia_logo_angled_shutterstock][1]
|
||||
|
||||
随着图形处理器在计算机里变得越来越常见,Nvidia 正在扩大与标准和开源社区的合作,以便于包括先前仅限于公司开发工具的下游技术。在 C++ 和 Fortran 等被认为在高度并行的计算机上执行代码时落后于本机实现的编程语言投入了大量精力。
|
||||
|
||||
Nvidia 的结合了开放和专有库的CUDA并行编程框架影响了许多正在开放和主流化的技术。在2007年,CUDA 作为一个为程序员开发基于 GPU 的系统的一系列编程工具和框架而推出。然而,随着 GPU 利用率在更多应用程序和领域中的增长,CUDA 理念发生了转变。
|
||||
|
||||
Nvidia 因其在 GPU 上的主导地位而广为人知,但 CUDA 是这家以1万亿市值为目标的软件和服务供应商重塑品牌的核心。Nvidia 的长期目标是成为一个全栈提供商,专注于,自动驾驶、量子全栈提供商计算、医疗保健、机器人、网络安全和量子计算等特定领域。
|
||||
|
||||
Nvidia 在特定领域创建了专用的 CUDA 库,以及企业和可以使用的硬件和服务。CEO 黄仁勋在最近的GPU技术大会上宣布“ AI 工厂”概念,最能体现全栈战略。客户可以将应用程序放入 Nvidia 的大型数据中心,从而获得针对特定行业或应用程序需求量身定制的定制 AI 模型。
|
||||
|
||||
Nvidia 可以通过两种方式从 AI 工厂原则中受益:利用 GPU 容量或利用特定领域的 CUDA 库。在 Nvidia GPU 上,程序员可以使用 OpenCL 等开源并行编程框架。 另一方面,CUDA 将为那些愿意投资的人提供额外的最后一英里增长,因为其已转向与 Nvidia 的 GPU 密切合作。
|
||||
|
||||
虽然并行编程在高性能计算中很常见常见,但 Nvidia 的目标是让其成为主流计算的标准。该公司正在协助实现一流工具的标准化,无论品牌、加速器类型或并行编程框架是什么,都可以编写可跨硬件平台移植的并行代码。
|
||||
|
||||
一方面,Nvidia 是 C++ 小组的成员,该小组正在为跨硬件同时执行可移植代码奠定基础。 上下文可以是主要执行 IO 的 CPU 线程,也可以是执行高要求计算的 CPU 或 GPU 线程。 Nvidia 特别致力于为 C++ 程序员提供异步和并行的标准语言和基础设施。
|
||||
|
||||
第一项工作侧重于内存模型,该模型已合并到 C++ 11 中,但当并行性和并发性变得更加普遍时,必须对其进行更新。 C++ 11 的内存模型强调跨多核 CPU 的并发执行,但它缺乏并行编程钩子。 C++ 17 标准为更高级别的并行特性奠定了基础,但真正的可移植性必须等待未来的标准。 C++ 20 是当前标准,C++ 23 即将推出。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/05/nvidia-begins-to-set-the-foundation-for-future-open-and-parallel-coding/
|
||||
|
||||
作者:[Laveesh Kocher][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/zxcv545)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/laveesh-kocher/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/05/Nvidia_logo_angled_shutterstock.jpg
|
Loading…
Reference in New Issue
Block a user