目录

计图挑战赛 赛道一热身赛:基于 GCN 的 Cora 节点分类

任务简介

在 Cora 引文网络(2708 节点 / 5429 边 / 1433 维特征 / 7 类)上训练标准 2 层 GCN 模型,对测试集节点预测类别。评测指标为分类准确率,≥ 0.70 即通过。

运行时环境

  • 操作系统:WSL2 Arch Linux x86_64
  • Python:3.10(conda 环境)
  • Jittor:1.3.11
  • JittorGeometric:2.0.0
  • GPU:NVIDIA RTX 5060 (Blackwell, sm_120),CUDA 13.3
  • 依赖包:numpy==1.24.0、scipy==1.15.1、networkx==3.4.2、scikit-learn==1.7.1、tqdm==4.66.4、einops

复现方式

# 1. 创建 conda 环境
conda create -n jittorgeometric python=3.10
conda activate jittorgeometric

# 2. 安装 Jittor
pip install git+https://github.com/Jittor/jittor.git

# 3. 安装官方依赖
pip install astunparse==1.6.3 numpy==1.24.0 pandas==2.2.3 Pillow==11.1.0 \
            six==1.16.0 pyparsing==3.2 scipy==1.15.1 setuptools==69.5.1 \
            sympy==1.13.3 tqdm==4.66.4 einops networkx==3.4.2 scikit-learn==1.7.1

# 4. 安装 JittorGeometric
git clone https://github.com/AlgRUC/JittorGeometric.git
cd JittorGeometric && pip install .

# 5. 准备数据(从赛题发布包获取)
mkdir -p data && cp /path/to/release/data/cora.pkl data/

# 6. 训练并预测
python gcn.py

GPU 环境补充说明(本机实际使用的环境):

本机 GPU 为 NVIDIA RTX 5060 (Blackwell, sm_120),CUDA 13.3,搭配 conda-forge 的 g++ 13 工具链编译。Jittor 1.3.11 在 CUDA 12.6/13 上有以下兼容性问题需处理:

  1. GCC 16 头文件问题:Arch Linux 系统 g++ 16 不再传递包含 <cstdint>, 需通过 cc_path 环境变量指定 conda 的 g++ 13:conda install -c conda-forge gxx_linux-64=13
  2. helper_cuda.h / cutt 兼容:CUDA 13 移除了 cudaDeviceProp.clockRate 等字段, 需 patch Jittor 的 extern/cuda/inc/helper_cuda.h 和 cutt 缓存源码。
  3. CCCL 头文件:CUDA 13 的 CCCL 要求 C++17,需 patch Jittor 的 compiler.pynvcc_flags 在 nvcc≥13 时不降级到 C++14。
  4. sm_120 架构支持:Jittor 1.3.11 默认 max_arch=90,需 patch 使其支持 sm_120。

以上 patch 均已内置在本仓库的 gcn.py 顶部环境配置中(自动检测并适配)。

结果

  • 验证集最佳准确率:约 0.80(远高于 0.70 通过阈值)
  • 训练约 30 秒(GPU: RTX 5060),代码自动适配 CPU/GPU
  • 模型:标准 2 层 GCN(GCNConv),hidden=256,dropout=0.5,Adam lr=0.01

感谢

  • Jittor — 计图深度学习框架
  • JittorGeometric — 图神经网络库
  • Cora 数据集由赛题发布方提供
关于
38.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号